Merge remote-tracking branch 'foodcoops/master' into feature-link_to_group_order

Conflicts:
	app/views/shared/_open_orders.html.haml
This commit is contained in:
wvengen 2013-11-25 10:11:56 +01:00
commit 1f08ee4759
58 changed files with 462 additions and 188 deletions

View file

@ -9,13 +9,15 @@
%table.table.table-striped
%thead
%tr
%th= t '.username'
- if FoodsoftConfig[:use_nick]
%th= t '.username'
%th= t '.name'
%th= t '.created_at'
- for user in @users
%tr{:class => cycle('even','odd', :name => 'users')}
%td= link_to user.nick, [:admin, user]
%td=h user.name
%td= link_to show_user(user), [:admin, user]
- if FoodsoftConfig[:use_nick]
%td= link_to user.name
%td= format_date(user.created_on)
= link_to t('.all_users'), admin_users_path
|

View file

@ -4,7 +4,8 @@
%table.table.table-striped
%thead
%tr
%th= t '.login'
- if FoodsoftConfig[:use_nick]
%th= t '.login'
%th= t '.name'
%th= t '.email'
%th= t 'admin.access_to'
@ -13,8 +14,9 @@
%tbody
- for user in @users
%tr
%td= link_to user.nick, [:admin, user]
%td= user.name
%td= link_to show_user(user), [:admin, user]
- if FoodsoftConfig[:use_nick]
%td= user.name
%td= user.email
%td= format_roles(user)
%td= format_time(user.last_login)

View file

@ -1,4 +1,4 @@
- title @user.nick
- title show_user(@user)
.row-fluid
.span3
@ -6,8 +6,9 @@
%h4= t '.person'
%p= t '.member_since', time: distance_of_time_in_words(Time.now, @user.created_on)
%dl
%dt= t '.nick'
%dd= @user.nick
- if FoodsoftConfig[:use_nick]
%dt= t '.nick'
%dd= @user.nick
%dt= t '.name'
%dd= h @user.name
%dt= t '.email'

View file

@ -16,7 +16,7 @@
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
%td=h format_time(order.ends) unless order.ends.nil?
%td= order.closed? ? t('.cleared', amount: number_to_currency(order.foodcoop_result)) : t('.ended')
%td= order.updated_by.nil? ? '??' : order.updated_by.nick
%td= show_user(order.updated_by)
%td
- unless order.closed?
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini btn-primary'

View file

@ -12,6 +12,6 @@
- @financial_transactions.each do |t|
%tr
%td= format_time(t.created_on)
%td= h t.user.nil? ? '??' : t.user.nick
%td= h show_user(t.user)
%td= h t.note
%td.currency{:style => "color:#{t.amount < 0 ? 'red' : 'black'}; width:5em"}= number_to_currency(t.amount)

View file

@ -13,7 +13,7 @@
- for ordergroup in @ordergroups
%tr
%td= ordergroup.name
%td=h ordergroup.users.collect { |u| u.nick }.join(", ")
%td=h ordergroup.users.collect { |u| show_user(u) }.join(", ")
%td= format_date ordergroup.orders.order('orders.starts DESC').first.try(:starts)
%td= link_to_new_message(message_params: {group_id: ordergroup.id})

View file

@ -4,7 +4,8 @@
%table.table.table-striped
%thead
%tr
%th= heading_helper User, :nick
- if FoodsoftConfig[:use_nick]
%th= heading_helper User, :nick
%th= heading_helper User, :name
%th= heading_helper User, :email
%th= heading_helper User, :phone
@ -13,8 +14,9 @@
%tbody
- for user in @users
%tr
%td= user.nick
%td= user.name if @current_user.role_admin? || user.settings.profile["name_is_public"]
- if FoodsoftConfig[:use_nick]
%td= show_user user
%td= user.name if @current_user.role_admin? || user.settings.profile["name_is_public"] || !FoodsoftConfig[:use_nick]
%td= user.email if @current_user.role_admin? || user.settings.profile["email_is_public"]
%td= user.phone if @current_user.role_admin? || user.settings.profile["phone_is_public"]
%td= user.ordergroup_name

View file

@ -30,7 +30,7 @@
%dt= t '.note'
%dd= @order.note
%dt= t '.created_by'
%dd= link_to_user_message_if_valid(@order.created_by)
%dd= show_user_link(@order.created_by)
%dt= t '.ending'
%dd= format_time(@order.ends)
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
@ -40,7 +40,7 @@
%dd= number_to_currency @order.sum
%dt= t '.last_update'
%dd
= @group_order.updated_by.nick if @group_order.updated_by
= show_user(@group_order.updated_by) if @group_order.updated_by
(#{format_time(@group_order.updated_on)})
%dt= t '.funds'
%dd= number_to_currency(@ordering_data[:available_funds])

View file

@ -22,7 +22,7 @@
- else
= t '.not_ordered'
- if @order.closed?
%p= t '.closed_by', user: @order.updated_by.nick
%p= t '.closed_by', user: show_user(@order.updated_by)
= link_to t('.comment'), "#comments"
// Article box

View file

@ -57,7 +57,7 @@
- for ft in current_user.ordergroup.financial_transactions.limit(5).order('created_on DESC')
%tr
%td= format_time(ft.created_on)
%td= h(ft.user.nil? ? '?' : ft.user.nick)
%td= h(show_user(ft.user))
%td= h(ft.note)
- color = ft.amount < 0 ? 'red' : 'black'
%td{:style => "color:#{color}; width:5em", :class => "currency"}= number_to_currency(ft.amount)

View file

@ -11,7 +11,7 @@
= number_to_currency(@ordergroup.get_available_funds())
%p
%b= Ordergroup.human_attribute_name(:user_tokens) + ':'
= @ordergroup.memberships.map{|m| m.user.nick}.join(', ')
= @ordergroup.memberships.map{|m| show_user m.user}.join(', ')
= link_to t('.invite'), new_invite_path(:id => @ordergroup), :remote => true, class: 'btn btn-primary'
.span8
%h2= t('.account_summary')

View file

@ -3,7 +3,7 @@
.row-fluid
.span7
%h3
= h(t('.user.title', user: @current_user.nick))
= h(t('.user.title', user: show_user))
%small= t '.user.since', when: distance_of_time_in_words(Time.now, @current_user.created_on)
= simple_form_for(@current_user, :url => update_profile_path) do |f|
= render :partial => 'shared/user_form_fields', :locals => {:f => f}

View file

@ -4,7 +4,7 @@
%ul.nav.nav-pills.pull-right
%li.dropdown
%a.dropdown-toggle(data-toggle="dropdown" href="#")
= current_user.nick
= show_user current_user
%b.caret
%ul.dropdown-menu
%li= link_to t('.profile'), my_profile_path

View file

@ -1,6 +1,6 @@
- content_for :javascript do
:javascript
$('user_nick').focus();
$(#{FoodsoftConfig[:use_nick] ? 'user_nick' : 'user_first_name'}).focus();
- title t('.title', name: FoodsoftConfig[:name])
= t('.body', group: h(@invite.group.name), foodcoop: h(FoodsoftConfig[:name])).html_safe

View file

@ -1,5 +1,5 @@
- title t('.title')
= t('.body', user: h(@user.nick)).html_safe
= raw t('.body', user: h(show_user(@user)))
= simple_form_for @user, :url => update_password_path(@user.id, :token => @user.reset_password_token) do |form|
= form.input :password
= form.input :password_confirmation

View file

@ -1,3 +1,3 @@
= t '.header', user: @user.nick, date: I18n.l(Time.now, :format => :short)
= t '.header', user: show_user(@user), date: I18n.l(Time.now, :format => :short)
\
= @feedback

View file

@ -1 +1 @@
= t '.text', group: @group.name, when: @transaction.created_on.strftime('%d.%m.%Y um %H:%M'), balance: @group.account_balance, amount:@transaction.amount, note: @transaction.note, user: @transaction.user.nick, foodcoop: FoodsoftConfig[:name]
= t '.text', group: @group.name, when: @transaction.created_on.strftime('%d.%m.%Y um %H:%M'), balance: @group.account_balance, amount:@transaction.amount, note: @transaction.note, user: show_user(@transaction.user), foodcoop: FoodsoftConfig[:name]

View file

@ -1,4 +1,4 @@
= raw t '.text0', ordergroup: @group_order.ordergroup.name, order: @order.name, when: I18n.l(@order.ends), user: @order.updated_by.nick
= raw t '.text0', ordergroup: @group_order.ordergroup.name, order: @order.name, when: I18n.l(@order.ends), user: show_user(@order.updated_by)
- for group_order_article in @group_order.group_order_articles.ordered.all(:include => :order_article)
- article = group_order_article.order_article.article
\- #{article.name}: #{group_order_article.result} x #{article.unit} = #{group_order_article.result * article.fc_price}

View file

@ -1 +1 @@
= raw t '.text', user: @user.nick, link: @link, expires: I18n.l(@user.reset_password_expires)
= raw t '.text', user: show_user(@user), link: @link, expires: I18n.l(@user.reset_password_expires)

View file

@ -36,7 +36,7 @@
= t '.list.mail', email: mail_to(FoodsoftConfig[:mailing_list_subscribe])
#recipients
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json }
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map(&:token_attributes).to_json }
= f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC, name ASC').all.reject { |g| g.memberships.empty? }
= f.input :private
= f.input :subject, input_html: {class: 'input-xxlarge'}

View file

@ -13,7 +13,7 @@
%dt= t '.note'
%dd= @order.note
%dt= t '.created_by'
%dd= link_to_user_message_if_valid(@order.created_by)
%dd= show_user_link(@order.created_by)
%dt= t '.begin'
%dd= format_time(@order.starts)
%dt= t '.ending'

View file

@ -12,12 +12,14 @@
= form_tag sessions_path, class: 'form-horizontal' do
.control-group
%label(for='nick' class='control-label')= t '.user'
%label(for='nick' class='control-label')
= User.human_attribute_name (FoodsoftConfig[:use_nick] ? :user : :email)
.controls
= text_field_tag 'nick', nil, autocapitalize: 'off', autocorrect: 'off'
.control-group
%label(for='password' class='control-label')= t '.password'
%label(for='password' class='control-label')
= User.human_attribute_name :password
.controls
= password_field_tag 'password', nil, autocapitalize: 'off', autocorrect: 'off'

View file

@ -1,5 +1,5 @@
- comments.each do |comment|
.comment[comment]
%strong= comment.user.try(:ordergroup_name)
%small (#{comment.user.try(:nick)} am #{format_time(comment.created_at)}):
%small (#{show_user comment.user} am #{format_time(comment.created_at)}):
= simple_format(comment.text)

View file

@ -12,7 +12,7 @@
%dd
- members = group.users
= "(#{members.size})"
= members.collect(&:nick).join(", ")
= members.collect{|u| show_user(u)}.join(", ")
- unless group.is_a?(Workgroup)
%dt= t '.apple_limit'
%dd= group.ignore_apple_restriction ? t('.deactivated') : t('.activated')

View file

@ -4,7 +4,7 @@
= yield
= f.input :user_tokens, :as => :string,
:input_html => { 'data-pre' => f.object.users.map { |u| u.token_attributes }.to_json }
:input_html => { 'data-pre' => f.object.users.map(&:token_attributes).to_json }
- content_for :javascript do
:javascript

View file

@ -19,7 +19,7 @@
%td= format_time(order.ends) unless order.ends.nil?
- if group_order = order.group_order(ordergroup)
- total += group_order.price
%td= "#{group_order.updated_by.nick} (#{format_time(group_order.updated_on)})"
%td= "#{show_user group_order.updated_by} (#{format_time(group_order.updated_on)})"
%td.numeric
= link_to_ordering(order, show: true) do
- number_to_currency(group_order.price)

View file

@ -1,4 +1,6 @@
= f.input :nick
- if FoodsoftConfig[:use_nick]
-# use_nil option to user model validators break required mark
= f.input :nick, required: true
= f.input :first_name
= f.input :last_name
= f.input :email
@ -19,7 +21,8 @@
= t 'simple_form.labels.settings.settings_group.privacy'
= profile.input 'phone_is_public', as: :boolean, label: false, input_html: { checked: f.object.settings.profile['phone_is_public'] }
= profile.input 'email_is_public', as: :boolean, label: false, input_html: { checked: f.object.settings.profile['email_is_public'] }
= profile.input 'name_is_public', as: :boolean, label: false, input_html: { checked: f.object.settings.profile['name_is_public'] }
- if FoodsoftConfig[:use_nick]
= profile.input 'name_is_public', as: :boolean, label: false, input_html: { checked: f.object.settings.profile['name_is_public'] }
.settings-group
%div{class: 'control-group'}

View file

@ -8,7 +8,8 @@
%div{id: "collapse#{workgroup.id}", class: 'accordion-body collapse'}
.accordion-inner
%ul.unstyled
- workgroup.users.includes(:groups).order('nick').each do |user|
- workgroup.users.includes(:groups).natural_order.each do |user|
%li
= user.nick
= show_user(user)
%small (#{user.ordergroup.try(:name)})

View file

@ -7,7 +7,7 @@
= simple_form_for(@stock_taking) do |f|
= f.input :date, as: :date_picker
= f.input :note, :input_html => {:size => "28x7", :value => "#{@current_user.nick}: ..."}
= f.input :note, :input_html => {:size => "28x7", :value => "#{show_user @current_user, unique: true}: ..."}
%h2= t '.stock_articles'
#stock_changes

View file

@ -19,7 +19,7 @@
= f.input :name
= f.input :description, as: :text, input_html: {rows: 10}
= f.input :duration, :as => :select, :collection => 1..3
= f.input :user_list, :as => :string, :input_html => { 'data-pre' => @task.users.map { |u| u.token_attributes }.to_json }
= f.input :user_list, :as => :string, :input_html => { 'data-pre' => @task.users.map(&:token_attributes).to_json }
= f.input :required_users
= f.association :workgroup
= f.input :due_date, as: :date_picker