add foodcoop configuration screen

This commit is contained in:
wvengen 2014-03-16 02:08:15 +01:00
parent dd3ac0971c
commit 7b000c39eb
20 changed files with 562 additions and 12 deletions

View file

@ -0,0 +1,10 @@
= config_input form, :name, required: true, input_html: {class: 'input-xlarge'}
= form.fields_for :contact do |c|
= config_input c, :street, input_html: {class: 'input-xlarge'}
.fold-line
= config_input c, :zip_code, input_html: {class: 'input-mini'}
= config_input c, :city, input_html: {class: 'input-medium'}
= config_input c, :country, as: :string, input_html: {class: 'input-xlarge'}
= config_input c, :email, required: true, input_html: {class: 'input-xlarge'}
= config_input c, :phone, input_html: {class: 'input-medium'}
= config_input form, :homepage, required: true, as: :url, input_html: {class: 'input-xlarge'}

View file

@ -0,0 +1,3 @@
= config_input form, :default_locale,
collection: I18n.available_locales.map {|l| [t("simple_form.options.settings.profile.language.#{l}"), l]}
= config_input form, :ignore_browser_locale, as: :boolean

View file

@ -0,0 +1,7 @@
= config_input form, :page_footer, as: :text, input_html: {class: 'input-xxlarge', rows: 2, placeholder: "#{link_to(FoodsoftConfig[:name], FoodsoftConfig[:homepage])}"}
%h4= t '.pdf_title'
.fold-line
= config_input form, :pdf_font_size, as: :integer, input_html: {class: 'input-mini'}
= config_input form, :pdf_page_size, input_html: {class: 'input-medium'}
= config_input form, :pdf_add_page_breaks, as: :boolean

View file

@ -0,0 +1,7 @@
%fieldset
%label
%h4= t '.emails_title'
= config_input form, :email_from, as: :string, input_html: {class: 'input-xlarge', placeholder: "#{@cfg[:name]} <#{@cfg[:contact][:email]}>"}
= config_input form, :email_replyto, as: :string, input_html: {class: 'input-xlarge'}
-# sender is better configured by server administrator, since it affects SPF records
-#= config_input form, :email_sender, as: :string, input_html: {class: 'input-xlarge'}

View file

@ -0,0 +1,5 @@
- if defined? FoodsoftWiki # avoid requiring deface here (the single exception)
= config_input form, :use_wiki, as: :boolean
= config_input form, :use_nick, as: :boolean
= config_input form, :tolerance_is_costly, as: :boolean
= config_input form, :help_url, as: :url, input_html: {class: 'input-xlarge'}

View file

@ -0,0 +1,12 @@
= config_input form, :price_markup do
.input-append
= config_input_field form, :price_markup, as: :decimal, class: 'input-mini'
%span.add-on %
= config_input form, :tax_default do
.input-append
= config_input_field form, :tax_default, as: :decimal, class: 'input-mini'
%span.add-on %
= config_input form, :minimum_balance do
.input-prepend
%span.add-on= t 'number.currency.format.unit'
= config_input_field form, :minimum_balance, as: :decimal, class: 'input-small'

View file

@ -0,0 +1,3 @@
-#= config_use_heading form, :use_tasks do
= config_use_heading form, :use_apple_points do
= config_input form, :stop_ordering_under, as: :numeric, input_html: {class: 'input-small'}

View file

@ -0,0 +1,11 @@
%ul.nav.nav-tabs.nav-tabs-with-heading
%li.heading
%h1= t '.title'
- for tab in @tabs
- url = action_name == 'show' ? nil : admin_config_path(tab: tab)
%li{class: ('active' if @current_tab==tab)}= link_to t("config.tabs.#{tab}"), "#{url}#tab-#{tab}", data: ({toggle: 'tab'} unless url)
-# make this a button to give some indicator that navigation away might lose changes
%li.pull-right{class: ('active' if @current_tab=='list')}
= link_to t('config.tabs.list'), list_admin_config_path, class: ('btn' unless @current_tab=='list')

View file

@ -0,0 +1,16 @@
- title t('.title'), false
= render 'tabs'
%table.table
%thead
%tr
%th= t '.key'
%th= t '.value'
%tbody
- @keys.each do |key|
%tr
%td
%tt= key
%td{style: if @cfg[key] != @dfl[key] then 'font-weight: bold' end}
= show_config_value key, @cfg[key]

View file

@ -0,0 +1,13 @@
- title t('admin.configs.tabs.title'), false
= simple_form_for :config, method: :patch do |f|
= render 'tabs', url: nil
.tab-content
- for tab in @tabs
.tab-pane{class: ('active' if @current_tab==tab), id: "tab-#{tab}"}= render "tab_#{tab}", form: f
.form-actions
= f.submit t('.submit'), class: 'btn btn-primary'