Merge branch 'master' into stable
2
Gemfile
|
@ -24,7 +24,7 @@ group :test do
|
|||
end
|
||||
|
||||
group :ldap do
|
||||
gem "net-ldap", '~> 0.2.2'
|
||||
gem "net-ldap", '~> 0.3.1'
|
||||
end
|
||||
|
||||
group :openid do
|
||||
|
|
2
Rakefile
|
@ -8,3 +8,5 @@ require 'rake/testtask'
|
|||
require 'rdoc/task'
|
||||
|
||||
require 'tasks/rails'
|
||||
# Load rake tasks from plugins in chiliproject_plugins
|
||||
Dir["#{RAILS_ROOT}/vendor/chiliproject_plugins/*/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
|
||||
|
|
|
@ -436,6 +436,7 @@ module ApplicationHelper
|
|||
css << 'theme-' + theme.name
|
||||
end
|
||||
|
||||
css << 'project-' + @project.id.to_s if @project.present?
|
||||
css << 'controller-' + params[:controller] if params[:controller]
|
||||
css << 'action-' + params[:action] if params[:action]
|
||||
css.join(' ')
|
||||
|
@ -867,12 +868,10 @@ module ApplicationHelper
|
|||
pcts << (100 - pcts[1] - pcts[0])
|
||||
width = options[:width] || '100px;'
|
||||
legend = options[:legend] || ''
|
||||
content_tag('table',
|
||||
content_tag('tr',
|
||||
(pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed') : '') +
|
||||
(pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done') : '') +
|
||||
(pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2]}%;", :class => 'todo') : '')
|
||||
), :class => 'progress', :style => "width: #{width};") +
|
||||
content_tag('div',
|
||||
content_tag('div', '', :style => "width: #{pcts[0]}%;", :class => 'closed ui-progressbar-value ui-widget-header ui-corner-left') +
|
||||
content_tag('div', '', :style => "width: #{pcts[1]}%;", :class => 'done ui-progressbar-value ui-widget-header'),
|
||||
:class => 'progress ui-progressbar ui-widget ui-widget-content ui-corner-all', :style => "width: #{width};") +
|
||||
content_tag('p', legend, :class => 'pourcent')
|
||||
end
|
||||
|
||||
|
@ -915,33 +914,25 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def calendar_for(field_id)
|
||||
include_calendar_headers_tags
|
||||
image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
|
||||
javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")
|
||||
javascript_tag("jQuery('##{field_id}').datepicker(datepickerSettings)")
|
||||
end
|
||||
|
||||
def include_calendar_headers_tags
|
||||
unless @calendar_headers_tags_included
|
||||
@calendar_headers_tags_included = true
|
||||
content_for :header_tags do
|
||||
start_of_week = case Setting.start_of_week.to_i
|
||||
when 1
|
||||
'Calendar._FD = 1;' # Monday
|
||||
when 7
|
||||
'Calendar._FD = 0;' # Sunday
|
||||
when 6
|
||||
'Calendar._FD = 6;' # Saturday
|
||||
else
|
||||
'' # use language
|
||||
end
|
||||
|
||||
javascript_include_tag('calendar/calendar') +
|
||||
javascript_include_tag("calendar/lang/calendar-#{current_language.to_s.downcase}.js") +
|
||||
javascript_tag(start_of_week) +
|
||||
javascript_include_tag('calendar/calendar-setup') +
|
||||
stylesheet_link_tag('calendar')
|
||||
end
|
||||
def jquery_datepicker_settings
|
||||
start_of_week = Setting.start_of_week.to_s
|
||||
start_of_week_string = start_of_week.present? ? "firstDay: '#{start_of_week}', " : ''
|
||||
script = javascript_tag("var datepickerSettings = {" +
|
||||
start_of_week_string +
|
||||
"showOn: 'both', " +
|
||||
"buttonImage: '" + path_to_image('/images/calendar.png') + "', " +
|
||||
"buttonImageOnly: true, " +
|
||||
"showButtonPanel: true, " +
|
||||
"dateFormat: 'yy-mm-dd' " +
|
||||
"}")
|
||||
unless current_language == :en
|
||||
jquery_locale = l("jquery.ui", :default => current_language.to_s)
|
||||
script << javascript_include_tag("libs/ui/i18n/jquery.ui.datepicker-#{jquery_locale}.js")
|
||||
end
|
||||
script
|
||||
end
|
||||
|
||||
def content_for(name, content = nil, &block)
|
||||
|
@ -996,6 +987,7 @@ module ApplicationHelper
|
|||
unless User.current.pref.warn_on_leaving_unsaved == '0'
|
||||
tags << "\n" + javascript_tag("Event.observe(window, 'load', function(){ new WarnLeavingUnsaved('#{escape_javascript( l(:text_warn_on_leaving_unsaved) )}'); });")
|
||||
end
|
||||
tags << jquery_datepicker_settings
|
||||
tags
|
||||
end
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ module CustomFieldsHelper
|
|||
field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
|
||||
case field_format.try(:edit_as)
|
||||
when "date"
|
||||
text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) +
|
||||
calendar_for(field_id)
|
||||
date_field_tag(field_name, custom_value.value, :id => field_id, :size => 10)
|
||||
when "text"
|
||||
text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%')
|
||||
when "bool"
|
||||
|
@ -71,8 +70,7 @@ module CustomFieldsHelper
|
|||
field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
|
||||
case field_format.try(:edit_as)
|
||||
when "date"
|
||||
text_field_tag(field_name, '', :id => field_id, :size => 10) +
|
||||
calendar_for(field_id)
|
||||
date_field_tag(field_name, '', :id => field_id, :size => 10)
|
||||
when "text"
|
||||
text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%')
|
||||
when "bool"
|
||||
|
|
|
@ -89,12 +89,12 @@ class Changeset < ActiveRecord::Base
|
|||
# Attribute reader for committer that encodes the committer string to
|
||||
# the repository log encoding (e.g. UTF-8)
|
||||
def committer
|
||||
self.class.to_utf8(read_attribute(:committer), repository.repo_log_encoding)
|
||||
self.class.to_utf8(read_attribute(:committer), repository_encoding)
|
||||
end
|
||||
|
||||
def before_create
|
||||
self.committer = self.class.to_utf8(self.committer, repository.repo_log_encoding)
|
||||
self.comments = self.class.normalize_comments(self.comments, repository.repo_log_encoding)
|
||||
self.committer = self.class.to_utf8(self.committer, repository_encoding)
|
||||
self.comments = self.class.normalize_comments(self.comments, repository_encoding)
|
||||
self.user = repository.find_committer_user(self.committer)
|
||||
end
|
||||
|
||||
|
|
|
@ -383,8 +383,10 @@ class Query < ActiveRecord::Base
|
|||
next unless v and !v.empty?
|
||||
operator = operator_for(field)
|
||||
|
||||
# "me" value subsitution
|
||||
if %w(assigned_to_id author_id watcher_id).include?(field)
|
||||
# "me" value substitution
|
||||
if %w(assigned_to_id author_id watcher_id).include?(field) ||
|
||||
# user custom fields
|
||||
available_filters.has_key?(field) && available_filters[field][:format] == 'user'
|
||||
v.push(User.current.logged? ? User.current.id.to_s : "0") if v.delete("me")
|
||||
end
|
||||
|
||||
|
@ -640,11 +642,15 @@ class Query < ActiveRecord::Base
|
|||
options = { :type => :list, :values => [[l(:general_text_yes), "1"], [l(:general_text_no), "0"]], :order => 20 }
|
||||
when "user", "version"
|
||||
next unless project
|
||||
options = { :type => :list_optional, :values => field.possible_values_options(project), :order => 20}
|
||||
values = field.possible_values_options(project)
|
||||
if User.current.logged? && field.field_format == 'user'
|
||||
values.unshift ["<< #{l(:label_me)} >>", "me"]
|
||||
end
|
||||
options = { :type => :list_optional, :values => values, :order => 20}
|
||||
else
|
||||
options = { :type => :string, :order => 20 }
|
||||
end
|
||||
@available_filters["cf_#{field.id}"] = options.merge({ :name => field.name })
|
||||
@available_filters["cf_#{field.id}"] = options.merge({ :name => field.name, :format => field.field_format })
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -185,8 +185,10 @@ private
|
|||
def self.find_or_default(name)
|
||||
name = name.to_s
|
||||
raise "There's no setting named #{name}" unless @@available_settings.has_key?(name)
|
||||
setting = find_by_name(name)
|
||||
setting ||= new(:name => name, :value => @@available_settings[name]['default']) if @@available_settings.has_key? name
|
||||
find_by_name(name) or new do |s|
|
||||
s.name = name
|
||||
s.value = @@available_settings[name]['default']
|
||||
end
|
||||
end
|
||||
|
||||
def self.cache_key(name)
|
||||
|
|
|
@ -46,12 +46,12 @@
|
|||
<div class="splitcontentright">
|
||||
<p>
|
||||
<label for='start_date'><%= l(:field_start_date) %></label>
|
||||
<%= text_field_tag 'start_date', '', :size => 10 %><%= calendar_for('start_date') %>
|
||||
<%= date_field_tag 'start_date', '', :size => 10 %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for='due_date'><%= l(:field_due_date) %></label>
|
||||
<%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>
|
||||
<%= date_field_tag 'due_date', '', :size => 10 %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
<p><%= f.text_field :start_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_start_date') if @issue.leaf? %></p>
|
||||
<p><%= f.text_field :due_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_due_date') if @issue.leaf? %></p>
|
||||
<p><%= f.date_field :start_date, :size => 10, :disabled => !@issue.leaf? %></p>
|
||||
<p><%= f.date_field :due_date, :size => 10, :disabled => !@issue.leaf? %></p>
|
||||
<p><%= f.text_field :estimated_hours, :size => 3, :disabled => !@issue.leaf? %> <%= l(:field_hours) %></p>
|
||||
<% if @issue.leaf? && Issue.use_field_for_done_ratio? %>
|
||||
<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
|
||||
|
|
|
@ -65,11 +65,11 @@
|
|||
<% end %>
|
||||
<p>
|
||||
<label for='issue_start_date'><%= l(:field_start_date) %></label>
|
||||
<%= text_field_tag 'issue[start_date]', '', :size => 10 %><%= calendar_for('issue_start_date') %>
|
||||
<%= date_field_tag 'issue[start_date]', '', :size => 10 %>
|
||||
</p>
|
||||
<p>
|
||||
<label for='issue_due_date'><%= l(:field_due_date) %></label>
|
||||
<%= text_field_tag 'issue[due_date]', '', :size => 10 %><%= calendar_for('issue_due_date') %>
|
||||
<%= date_field_tag 'issue[due_date]', '', :size => 10 %>
|
||||
</p>
|
||||
<% if Issue.use_field_for_done_ratio? %>
|
||||
<p>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<!doctype html>
|
||||
<html lang="<%= current_language %>">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta charset="utf-8" />
|
||||
<title><%= html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
|
@ -20,6 +20,7 @@
|
|||
<%= javascript_include_tag 'jquery-ui.min.js' %>
|
||||
<%= javascript_include_tag 'jquery.menu_expand.js' %>
|
||||
<%= javascript_tag('jQuery.noConflict();') %>
|
||||
<%= javascript_include_tag 'modernizr.min.js' %>
|
||||
<%= javascript_heads %>
|
||||
<%= stylesheet_link_tag 'jstoolbar' %>
|
||||
<%= heads_for_theme %>
|
||||
|
@ -34,12 +35,14 @@
|
|||
<div id="header">
|
||||
<div id="logo"><%= link_to(h(Setting.app_title), home_path) %></div>
|
||||
<div id="top-menu-items">
|
||||
<% if User.current.logged? || !Setting.login_required? %>
|
||||
<div id="search">
|
||||
<%= render :partial => 'search/quick_search', :locals => {:search_term => @question} %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.logged? || !Setting.login_required? %>
|
||||
<ul id="account-nav">
|
||||
<% if User.current.logged? || !Setting.login_required? %>
|
||||
<% main_top_menu_items.each do |item| %>
|
||||
<%= render_menu_node(item) %>
|
||||
<% end %>
|
||||
|
@ -74,7 +77,8 @@
|
|||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<%= render_menu_node(help_menu_item) %>
|
||||
<%= render_menu_node(help_menu_item) %>
|
||||
<% end %>
|
||||
<% unless User.current.logged? %>
|
||||
<% if Setting.self_registration? %>
|
||||
<li>
|
||||
|
@ -98,7 +102,6 @@
|
|||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="breadcrumb">
|
||||
|
|
|
@ -42,10 +42,17 @@ function enableValues(field, indexes) {
|
|||
f[i].up('span').hide();
|
||||
}
|
||||
}
|
||||
var hasDateFields = ((jQuery("#div_values_" + field).find('input[type="date"]').size() > 0) && (Modernizr.inputtypes.date === false));
|
||||
if (indexes.length > 0) {
|
||||
Element.show("div_values_" + field);
|
||||
if(hasDateFields) {
|
||||
jQuery("#div_values_" + field).find('input[type="date"]').datepicker('enable');
|
||||
}
|
||||
} else {
|
||||
Element.hide("div_values_" + field);
|
||||
if(hasDateFields) {
|
||||
jQuery("#div_values_" + field).find('input[type="date"]').datepicker('disable');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,6 +102,9 @@ function apply_filters_observer() {
|
|||
:complete => "e.stop(); apply_filters_observer()") %>
|
||||
}
|
||||
});
|
||||
if(Modernizr.inputtypes.date === false) {
|
||||
jQuery('#query_form input[type="date"]').datepicker(datepickerSettings);
|
||||
}
|
||||
}
|
||||
Event.observe(document,"dom:loaded", apply_filters_observer);
|
||||
//]]>
|
||||
|
@ -125,8 +135,8 @@ Event.observe(document,"dom:loaded", apply_filters_observer);
|
|||
<%= link_to_function image_tag('bullet_toggle_plus.png'), "toggle_multi_select('values_#{field}_1');", :style => "vertical-align: bottom;" %>
|
||||
</span>
|
||||
<% when :date, :date_past %>
|
||||
<span class="span_values_<%= field %>"><%= text_field_tag "v[#{field}][]", query.value_for(field), :size => 10, :class => "values_#{field}", :id => "values_#{field}_1" %> <%= calendar_for "values_#{field}_1" %></span>
|
||||
<span class="span_values_<%= field %>"><%= text_field_tag "v[#{field}][]", query.value_for(field, 1), :size => 10, :class => "values_#{field}", :id => "values_#{field}_2" %> <%= calendar_for "values_#{field}_2" %></span>
|
||||
<span class="span_values_<%= field %>"><%= date_field_tag "v[#{field}][]", query.value_for(field), :size => 10, :class => "values_#{field}", :id => "values_#{field}_1" %></span>
|
||||
<span class="span_values_<%= field %>"><%= date_field_tag "v[#{field}][]", query.value_for(field, 1), :size => 10, :class => "values_#{field}", :id => "values_#{field}_2" %></span>
|
||||
<span class="span_values_<%= field %>"><%= text_field_tag "v[#{field}][]", query.value_for(field), :size => 3, :class => "values_#{field}" %> <%= l(:label_day_plural) %></span>
|
||||
<% when :string, :text %>
|
||||
<span class="span_values_<%= field %>"><%= text_field_tag "v[#{field}][]", query.value_for(field), :class => "values_#{field}", :id => "values_#{field}", :size => 30 %></span>
|
||||
|
|
|
@ -18,13 +18,11 @@
|
|||
l(:label_date_from_to,
|
||||
:start => (
|
||||
label_tag("from", l(:description_date_from), :class => "hidden-for-sighted") +
|
||||
text_field_tag('from', @from, :size => 10, :disabled => !@free_period) +
|
||||
calendar_for('from')
|
||||
date_field_tag('from', @from, :size => 10, :disabled => !@free_period)
|
||||
),
|
||||
:end => (
|
||||
label_tag("to", l(:description_date_to), :class => "hidden-for-sighted") +
|
||||
text_field_tag('to', @to, :size => 10, :disabled => !@free_period) +
|
||||
calendar_for('to')
|
||||
date_field_tag('to', @to, :size => 10, :disabled => !@free_period)
|
||||
)
|
||||
)
|
||||
%>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<div class="box">
|
||||
<p><%= f.text_field :issue_id, :size => 6 %> <em><%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %></em></p>
|
||||
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
|
||||
<p><%= f.date_field :spent_on, :size => 10, :required => true %></p>
|
||||
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
|
||||
<p><%= f.text_field :comments, :size => 100 %></p>
|
||||
<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<p><%= f.text_field :description, :size => 60 %></p>
|
||||
<p><%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %></p>
|
||||
<p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
|
||||
<p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('version_start_date') %></p>
|
||||
<p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
|
||||
<p><%= f.date_field :start_date, :size => 10 %></p>
|
||||
<p><%= f.date_field :effective_date, :size => 10 %></p>
|
||||
<p><%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %></p>
|
||||
|
||||
<% @version.custom_field_values.each do |value| %>
|
||||
|
|
|
@ -24,9 +24,12 @@ ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] if ENV['RACK_ENV']
|
|||
# Specifies gem version of Rails to use when vendor/rails is not present
|
||||
RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION
|
||||
|
||||
# this is replaced by config.encoding = "utf-8" in rails3
|
||||
if RUBY_VERSION >= '1.9'
|
||||
Encoding.default_external = 'UTF-8'
|
||||
Encoding.default_internal = 'UTF-8'
|
||||
else
|
||||
$KCODE='UTF-8'
|
||||
end
|
||||
|
||||
# Bootstrap the Rails environment, frameworks, and default configuration
|
||||
|
|
|
@ -78,6 +78,53 @@ module ActionView
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
module FormHelper
|
||||
# Returns an input tag of the "date" type tailored for accessing a specified attribute (identified by +method+) on an object
|
||||
# assigned to the template (identified by +object+). Additional options on the input tag can be passed as a
|
||||
# hash with +options+. These options will be tagged onto the HTML as an HTML element attribute as in the example
|
||||
# shown.
|
||||
#
|
||||
# ==== Examples
|
||||
# date_field(:user, :birthday, :size => 20)
|
||||
# # => <input type="date" id="user_birthday" name="user[birthday]" size="20" value="#{@user.birthday}" />
|
||||
#
|
||||
# date_field(:user, :birthday, :class => "create_input")
|
||||
# # => <input type="date" id="user_birthday" name="user[birthday]" value="#{@user.birthday}" class="create_input" />
|
||||
#
|
||||
# NOTE: This will be part of rails 4.0, the monkey patch can be removed by then.
|
||||
def date_field(object_name, method, options = {})
|
||||
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("date", options)
|
||||
end
|
||||
end
|
||||
|
||||
# As ActionPacks metaprogramming will already have happened when we're here,
|
||||
# we have to tell the FormBuilder about the above date_field ourselvse
|
||||
#
|
||||
# NOTE: This can be remove when the above ActionView::Helpers::FormHelper#date_field is removed
|
||||
class FormBuilder
|
||||
self.field_helpers << "date_field"
|
||||
|
||||
def date_field(method, options = {})
|
||||
@template.date_field(@object_name, method, objectify_options(options))
|
||||
end
|
||||
end
|
||||
|
||||
module FormTagHelper
|
||||
# Creates a date form input field.
|
||||
#
|
||||
# ==== Options
|
||||
# * Creates standard HTML attributes for the tag.
|
||||
#
|
||||
# ==== Examples
|
||||
# date_field_tag 'meeting_date'
|
||||
# # => <input id="meeting_date" name="meeting_date" type="date" />
|
||||
#
|
||||
# NOTE: This will be part of rails 4.0, the monkey patch can be removed by then.
|
||||
def date_field_tag(name, value = nil, options = {})
|
||||
text_field_tag(name, value, options.stringify_keys.update("type" => "date"))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# by Vladimir Medarović (vlada@medarovic.com)
|
||||
sr-YU:
|
||||
direction: ltr
|
||||
jquery:
|
||||
ui: "sr-SR"
|
||||
date:
|
||||
formats:
|
||||
# Use the strftime parameters for formats.
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
"zh-TW":
|
||||
direction: ltr
|
||||
jquery:
|
||||
# Falls back to the value in zh.yml if not set
|
||||
ui: "zh-TW"
|
||||
date:
|
||||
formats:
|
||||
# Use the strftime parameters for formats.
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
zh:
|
||||
direction: ltr
|
||||
jquery:
|
||||
ui: "zh-CN"
|
||||
date:
|
||||
formats:
|
||||
default: "%Y-%m-%d"
|
||||
|
|
|
@ -19,9 +19,9 @@ rescue LoadError
|
|||
raise "Could not load the bundler gem. Install it with `gem install bundler`."
|
||||
end
|
||||
|
||||
if Gem::Version.new(Bundler::VERSION) < Gem::Version.new("1.0.6")
|
||||
if Gem::Version.new(Bundler::VERSION) < Gem::Version.new("1.0.14")
|
||||
raise RuntimeError, "Your bundler version is too old. We require " +
|
||||
"at least version 1.0.6. Run `gem install bundler` to upgrade."
|
||||
"at least version 1.0.14. Run `gem install bundler` to upgrade."
|
||||
end
|
||||
|
||||
begin
|
||||
|
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 857 B |
|
@ -64,6 +64,21 @@ module ChiliProject
|
|||
count.to_i > 0 ? array[(count.to_i * -1)..-1] : []
|
||||
end
|
||||
end
|
||||
|
||||
def date(input, format=nil)
|
||||
if format.nil?
|
||||
return "" unless input
|
||||
if Setting.date_format.blank?
|
||||
input = super(input, '%Y-%m-%d')
|
||||
return ::I18n.l(input.to_date) if input.respond_to?(:to_date)
|
||||
input # default return value
|
||||
else
|
||||
super(input, Setting.date_format)
|
||||
end
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Filters
|
||||
|
|
|
@ -21,18 +21,23 @@ module ChiliProject
|
|||
base.extend(ClassMethods)
|
||||
|
||||
base.class_attribute :filters, :instance_reader => false, :instance_writer => false
|
||||
base.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
||||
self.filters = @@filters.values
|
||||
RUBY
|
||||
base.class_eval do
|
||||
self.filters = base.send(:class_variable_get, '@@filters').values
|
||||
|
||||
class << self
|
||||
alias_method_chain :global_filter, :filter_array
|
||||
alias_method_chain :create, :filter_array
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def global_filter(filter)
|
||||
def global_filter_with_filter_array(filter)
|
||||
raise ArgumentError, "Passed filter is not a module" unless filter.is_a?(Module)
|
||||
filters += [filter]
|
||||
self.filters += [filter]
|
||||
end
|
||||
|
||||
def create(context)
|
||||
def create_with_filter_array(context)
|
||||
strainer = self.new(context)
|
||||
filters.each { |filter| strainer.extend(filter) }
|
||||
strainer
|
||||
|
|
|
@ -53,6 +53,10 @@ module ChiliProject
|
|||
vars.uniq.sort
|
||||
end
|
||||
|
||||
register "today" do
|
||||
Date.today.to_s
|
||||
end
|
||||
|
||||
# DEPRACATED: This is just a hint on how to use Liquid introspection
|
||||
register "macro_list",
|
||||
"Use '{{ variables | to_list: \"Variables:\" }}' to see all Liquid variables and '{{ tags | to_list: \"Tags:\" }}' to see all of the Liquid tags."
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ActiveSupport::Deprecation.warn("\"require gravatar\" is not needed anymore. Please remove this statement from your code.")
|
||||
require "gravatarify"
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 414 B |
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 115 B |
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 98 B |
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 111 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 110 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 87 B |
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 115 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 84 B |
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 81 B |
Before Width: | Height: | Size: 939 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 475 B After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 118 B |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 123 B |
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 244 B After Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 593 B After Width: | Height: | Size: 529 B |
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 309 B |
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 662 B |
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 112 B |
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 110 B |
Before Width: | Height: | Size: 413 B After Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 405 B |
Before Width: | Height: | Size: 727 B After Width: | Height: | Size: 711 B |
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 659 B |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 91 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 88 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 91 B |
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 89 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1017 B |
Before Width: | Height: | Size: 960 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 647 B |
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 427 B After Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 534 B After Width: | Height: | Size: 527 B |
Before Width: | Height: | Size: 647 B After Width: | Height: | Size: 641 B |
Before Width: | Height: | Size: 538 B After Width: | Height: | Size: 530 B |
Before Width: | Height: | Size: 485 B After Width: | Height: | Size: 479 B |
Before Width: | Height: | Size: 573 B After Width: | Height: | Size: 565 B |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 542 B |
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 970 B After Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 973 B After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 590 B After Width: | Height: | Size: 513 B |
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 584 B |