Initial commit of foodsoft 2
This commit is contained in:
commit
5b9a7e05df
657 changed files with 70444 additions and 0 deletions
2
app/helpers/admin_helper.rb
Normal file
2
app/helpers/admin_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module AdminHelper
|
||||
end
|
||||
84
app/helpers/application_helper.rb
Normal file
84
app/helpers/application_helper.rb
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# Methods added to this helper will be available to all templates in the application.
|
||||
module ApplicationHelper
|
||||
|
||||
def format_time(time = Time.now)
|
||||
FoodSoft::format_date_time(time) unless time.nil?
|
||||
end
|
||||
|
||||
def format_date(time = Time.now)
|
||||
FoodSoft::format_date(time) unless time.nil?
|
||||
end
|
||||
|
||||
# Creates ajax-controlled-links for pagination
|
||||
# see also the plugin "will_paginate"
|
||||
def pagination_links_remote(collection, per_page = @per_page, params = {})
|
||||
# Translations
|
||||
prev_label = '« ' + _('Previous')
|
||||
next_label = _('Next') + ' »'
|
||||
# Merge other url-options for will_paginate
|
||||
params = params.merge({:per_page => per_page})
|
||||
will_paginate collection, {:params => params, :remote => true, :prev_label => prev_label, :next_label => next_label}
|
||||
end
|
||||
|
||||
# Link-collection for per_page-options when using the pagination-plugin
|
||||
def items_per_page(per_page_options = [20, 50, 100], current = @per_page, action = controller.action_name)
|
||||
links = []
|
||||
per_page_options.each do |per_page|
|
||||
unless per_page == current
|
||||
links << link_to_remote(per_page, {:url => {:action => action, :params => {:per_page => per_page}},
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')"})
|
||||
else
|
||||
links << per_page
|
||||
end
|
||||
end
|
||||
return _('Per page: ') + links.join(" ")
|
||||
end
|
||||
|
||||
def sort_td_class_helper(param)
|
||||
result = 'class="sortup"' if params[:sort] == param
|
||||
result = 'class="sortdown"' if params[:sort] == param + "_reverse"
|
||||
return result
|
||||
end
|
||||
|
||||
def sort_link_helper(text, param, per_page = 10)
|
||||
key = param
|
||||
key += "_reverse" if params[:sort] == param
|
||||
options = {
|
||||
:url => {:action => 'list', :params => params.merge({:sort => key, :page => nil, :per_page => per_page})},
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')"
|
||||
}
|
||||
html_options = {
|
||||
:title => _('Sort by this field'),
|
||||
:href => url_for(:action => 'list', :params => params.merge({:sort => key, :page => nil, :per_page => per_page}))
|
||||
}
|
||||
link_to_remote(text, options, html_options)
|
||||
end
|
||||
|
||||
# Generates a link to the top of the website
|
||||
def link_to_top
|
||||
link_to image_tag("arrow_up_red.png", :size => "16x16", :border => "0", :alt => "Nach oben"), "#"
|
||||
end
|
||||
|
||||
# Returns the weekday. 0 is sunday, 1 is monday and so on
|
||||
def weekday(dayNumber)
|
||||
weekdays = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
|
||||
return weekdays[dayNumber]
|
||||
end
|
||||
|
||||
# highlights a phrase in given text
|
||||
# based on the rails text-helper 'highlight'
|
||||
def highlight_phrase(text, phrase, highlighter = '<strong class="highlight">\1</strong>')
|
||||
unless phrase.blank? || text.nil?
|
||||
phrase.split(' ').each {|keyword| text.gsub!(/(#{Regexp.escape(keyword)})/i, highlighter)}
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
# to set a title for both the h1-tag and the title in the header
|
||||
def title(page_title)
|
||||
content_for(:title) { page_title }
|
||||
end
|
||||
|
||||
end
|
||||
7
app/helpers/articles_helper.rb
Normal file
7
app/helpers/articles_helper.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
module ArticlesHelper
|
||||
|
||||
# useful for highlighting attributes, when synchronizing articles
|
||||
def highlight_new(unequal_attributes, attribute)
|
||||
unequal_attributes.detect {|a| a == attribute} ? "background-color: yellow" : ""
|
||||
end
|
||||
end
|
||||
2
app/helpers/finance_helper.rb
Normal file
2
app/helpers/finance_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module FinanceHelper
|
||||
end
|
||||
2
app/helpers/groups_helper.rb
Normal file
2
app/helpers/groups_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module GroupsHelper
|
||||
end
|
||||
2
app/helpers/index_helper.rb
Normal file
2
app/helpers/index_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module IndexHelper
|
||||
end
|
||||
2
app/helpers/login_helper.rb
Normal file
2
app/helpers/login_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module LoginHelper
|
||||
end
|
||||
2
app/helpers/messages_helper.rb
Normal file
2
app/helpers/messages_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module MessagesHelper
|
||||
end
|
||||
2
app/helpers/ordering_helper.rb
Normal file
2
app/helpers/ordering_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module OrderingHelper
|
||||
end
|
||||
11
app/helpers/orders_helper.rb
Normal file
11
app/helpers/orders_helper.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
module OrdersHelper
|
||||
require 'iconv'
|
||||
|
||||
# This method is needed to convert special characters into UTF-8 for rendering PDF files correctly.
|
||||
def replace_UTF8(field)
|
||||
ic_ignore = Iconv.new('ISO-8859-15//IGNORE//TRANSLIT', 'UTF-8')
|
||||
field = ic_ignore.iconv(field)
|
||||
ic_ignore.close
|
||||
field
|
||||
end
|
||||
end
|
||||
2
app/helpers/suppliers_helper.rb
Normal file
2
app/helpers/suppliers_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module SuppliersHelper
|
||||
end
|
||||
10
app/helpers/tasks_helper.rb
Normal file
10
app/helpers/tasks_helper.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
module TasksHelper
|
||||
|
||||
# generate colored number of still required users
|
||||
def highlighted_required_users(task)
|
||||
unless task.enough_users_assigned?
|
||||
still_required = task.required_users - task.assignments.select { |ass| ass.accepted }.size
|
||||
"<small style='color:red;font-weight:bold'>(#{still_required})</small>"
|
||||
end
|
||||
end
|
||||
end
|
||||
2
app/helpers/users_helper.rb
Normal file
2
app/helpers/users_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module UsersHelper
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue