admix 0.23.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/app/assets/javascripts/admix/application.js.coffee +30 -2
- data/app/assets/stylesheets/admix/application.css +6 -1
- data/app/assets/stylesheets/admix/wice_grid.css.scss +143 -0
- data/app/controllers/admix/inherited_controller.rb +13 -34
- data/app/controllers/admix/registrations_controller.rb +2 -0
- data/app/controllers/admix/rest_controller.rb +46 -0
- data/app/helpers/admix/tab.rb +33 -0
- data/app/helpers/admix_helper.rb +76 -0
- data/app/views/admix/inherited/_actions.haml +7 -0
- data/app/views/admix/inherited/_column_actions.haml +3 -0
- data/app/views/admix/inherited/_empty_grid.haml +3 -0
- data/app/views/admix/inherited/_form_config.haml +0 -0
- data/app/views/admix/inherited/_grid.haml +5 -0
- data/app/views/admix/inherited/_grid_actions.haml +1 -0
- data/app/views/admix/inherited/_grid_columns.haml +11 -0
- data/app/views/admix/inherited/edit.html.haml +3 -3
- data/app/views/admix/inherited/form.html.haml +52 -0
- data/app/views/admix/inherited/index.html.haml +3 -5
- data/app/views/admix/inherited/new.html.haml +3 -3
- data/app/views/admix/inherited/show.html.haml +3 -5
- data/app/views/admix/rest/_actions.haml +7 -0
- data/app/views/admix/rest/_column_actions.haml +3 -0
- data/app/views/admix/rest/_empty_grid.haml +3 -0
- data/app/views/admix/rest/_form_config.haml +0 -0
- data/app/views/admix/rest/_grid.haml +5 -0
- data/app/views/admix/rest/_grid_actions.haml +1 -0
- data/app/views/admix/rest/_grid_columns.haml +11 -0
- data/app/views/admix/rest/edit.html.haml +5 -0
- data/app/views/admix/rest/form.html.haml +50 -0
- data/app/views/admix/rest/index.html.haml +3 -0
- data/app/views/admix/rest/new.html.haml +3 -0
- data/app/views/admix/rest/show.html.haml +3 -0
- data/app/views/layouts/admix/{admix.html.haml → admix.haml} +2 -2
- data/app/views/layouts/admix/{login.html.haml → login.haml} +1 -1
- data/config/admix_navigation.rb +34 -49
- data/config/application.rb +0 -2
- data/config/initializers/admix.rb +0 -3
- data/config/initializers/wice_grid_config.rb +142 -0
- data/config/locales/admix.pt-BR.yml +10 -3
- data/config/locales/wice_grid.yml +502 -0
- data/lib/admix.rb +1 -3
- data/lib/admix/engine.rb +28 -0
- data/lib/admix/version.rb +2 -2
- metadata +51 -71
- data/app/views/admix/inherited/_form.html.haml +0 -14
- data/app/views/admix/inherited/_table_actions.html.haml +0 -3
- data/config/initializers/locale.rb +0 -1
- data/lib/admix/table-actions.rb +0 -17
@@ -0,0 +1,7 @@
|
|
1
|
+
.well
|
2
|
+
= link_to "#{t('admix.crud.new.link')} " + t("#{@collection_name}.#{@collection_name.singularize}"), new_resource_url, class: 'btn'
|
3
|
+
= link_to t('admix.crud.list.title', resources: t("#{@collection_name}.#{@collection_name}")), collection_url, class: 'btn'
|
4
|
+
- if not ['index', 'edit'].include? params[:action]
|
5
|
+
- if not resource.nil? and not resource.new_record?
|
6
|
+
= link_edit(resource, t('admix.crud.edit.link'), 'btn-primary')
|
7
|
+
= link_destroy(resource, t('admix.crud.destroy.link'), 'btn-danger')
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
= grid_actions_for(obj)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
- if resource_class.column_names.include? 'name'
|
2
|
+
- grid.column name: input_label(:defaults, :name), attribute: 'name' do |obj|
|
3
|
+
- obj.name
|
4
|
+
- elsif resource_class.column_names.include? 'title'
|
5
|
+
- grid.column name: input_label(:defaults, :title), attribute: 'title' do |obj|
|
6
|
+
- obj.title
|
7
|
+
- elsif resource_class.column_names.include? 'email'
|
8
|
+
- grid.column name: input_label(:defaults, :email), attribute: 'email' do |obj|
|
9
|
+
- obj.email
|
10
|
+
|
11
|
+
- column_actions(grid)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- collection_name = resource_class.to_s.downcase.pluralize
|
2
2
|
- resource_name = resource_class.to_s.downcase
|
3
|
-
|
4
|
-
=
|
5
|
-
=
|
3
|
+
= render 'actions'
|
4
|
+
-#%h1= t('admix.crud.edit.title', resource: resource[@crumb_field])
|
5
|
+
= render file: 'admix/inherited/form'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
- array_of_resources = [:admix]
|
2
|
+
- if defined? parent_type
|
3
|
+
- array_of_resources << parent_type
|
4
|
+
- array_of_resources << resource
|
5
|
+
|
6
|
+
= content_for(:before_form)
|
7
|
+
= simple_form_for array_of_resources, :html => { :class => 'form-admix' }, wrapper: :bootstrap do |f|
|
8
|
+
= render partial: 'form_config', locals: {f:f}
|
9
|
+
= content_for(:before_inner_form)
|
10
|
+
= content_for(:before_errors)
|
11
|
+
= f.error_notification
|
12
|
+
= content_for(:after_errors)
|
13
|
+
.row-fluid
|
14
|
+
.span7
|
15
|
+
.row-fluid
|
16
|
+
.span12
|
17
|
+
.tabbable.tabs-left
|
18
|
+
%ul#admix_form_tabs.nav.nav-tabs
|
19
|
+
- if content_for?(:nav_tabs)
|
20
|
+
= content_for(:nav_tabs)
|
21
|
+
- elsif @admix_tabs
|
22
|
+
- @admix_tabs.each do |tab|
|
23
|
+
= tab.header
|
24
|
+
.tab-content.well
|
25
|
+
- if content_for?(:tabs_content)
|
26
|
+
= content_for(:tabs_content)
|
27
|
+
- elsif @admix_tabs
|
28
|
+
- @admix_tabs.each do |tab|
|
29
|
+
.tab-pane{id: tab.tab_id, class: (tab.options[:first] ? 'active' : '')}
|
30
|
+
.span12
|
31
|
+
.row-fluid
|
32
|
+
= tab.content
|
33
|
+
.span4
|
34
|
+
%ul.nav.nav-list.well
|
35
|
+
%li
|
36
|
+
.div
|
37
|
+
= f.button :submit, class: 'btn-primary'
|
38
|
+
= link_to t('admix.crud.cancel'), collection_url, class: 'btn'
|
39
|
+
- if not resource.nil? and not resource.new_record?
|
40
|
+
= link_destroy(resource, t('admix.crud.destroy.link'), 'btn-danger')
|
41
|
+
- if content_for?(:form_options)
|
42
|
+
%li.nav-header Opções
|
43
|
+
%li
|
44
|
+
= content_for(:form_options)
|
45
|
+
|
46
|
+
|
47
|
+
= content_for(:after_inner_form)
|
48
|
+
= content_for(:after_form)
|
49
|
+
:coffeescript
|
50
|
+
$('#admix_form_tabs a').click (e) ->
|
51
|
+
e.preventDefault()
|
52
|
+
$(this).tab('show')
|
@@ -1,5 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
=
|
4
|
-
= will_paginate @assets, :renderer => BootstrapPagination::Rails
|
5
|
-
= link_to t('admix.crud.new.link'), new_resource_url, class: 'btn'
|
1
|
+
= render 'actions'
|
2
|
+
-#%h1= t('admix.crud.listing', resources: t("#{@collection_name}.#{@collection_name}"))
|
3
|
+
= render partial: 'grid'
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
=
|
3
|
-
=
|
1
|
+
= render 'actions'
|
2
|
+
-#%h1= t('admix.crud.new.title')
|
3
|
+
= render file: 'admix/inherited/form'
|
@@ -1,5 +1,3 @@
|
|
1
|
-
|
2
|
-
=
|
3
|
-
|
4
|
-
.well{style: 'clear:both;'}
|
5
|
-
= link_to t('admix.crud.list.title', resources: t("#{@collection_name}.#{@collection_name}")), collection_url, class: 'btn'
|
1
|
+
= render 'actions'
|
2
|
+
-#%h1= t('admix.crud.show.title')
|
3
|
+
= render partial: 'show', locals: {resource: resource}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
.well
|
2
|
+
= link_to "#{t('admix.crud.new.link')} " + t("#{@collection_name}.#{@collection_name.singularize}"), new_resource_url, class: 'btn'
|
3
|
+
= link_to t('admix.crud.list.title', resources: t("#{@collection_name}.#{@collection_name}")), collection_url, class: 'btn'
|
4
|
+
- if not ['index', 'edit'].include? params[:action]
|
5
|
+
- if not resource.nil? and not resource.new_record?
|
6
|
+
= link_edit(resource, t('admix.crud.edit.link'), 'btn-primary')
|
7
|
+
= link_destroy(resource, t('admix.crud.destroy.link'), 'btn-danger')
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
= grid_actions_for(obj)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
- if resource_class.column_names.include? 'name'
|
2
|
+
- grid.column name: input_label(:defaults, :name), attribute: 'name' do |obj|
|
3
|
+
- obj.name
|
4
|
+
- elsif resource_class.column_names.include? 'title'
|
5
|
+
- grid.column name: input_label(:defaults, :title), attribute: 'title' do |obj|
|
6
|
+
- obj.title
|
7
|
+
- elsif resource_class.column_names.include? 'email'
|
8
|
+
- grid.column name: input_label(:defaults, :email), attribute: 'email' do |obj|
|
9
|
+
- obj.email
|
10
|
+
|
11
|
+
- column_actions(grid)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
- array_of_resources = [:admix]
|
2
|
+
- if defined? parent_type
|
3
|
+
- array_of_resources << parent_type
|
4
|
+
- array_of_resources << resource
|
5
|
+
|
6
|
+
= simple_form_for array_of_resources, :html => {:name => 'AdmixForm', :class => 'form-admix', 'ng-controller' => 'FormController' }, wrapper: :bootstrap do |f|
|
7
|
+
%h1 {{method}}
|
8
|
+
= render partial: 'form_config', locals: {f:f}
|
9
|
+
= f.error_notification
|
10
|
+
|
11
|
+
.row-fluid
|
12
|
+
.span7
|
13
|
+
.row-fluid
|
14
|
+
.span12
|
15
|
+
.tabbable.tabs-left
|
16
|
+
%ul#admix_form_tabs.nav.nav-tabs
|
17
|
+
- if content_for?(:nav_tabs)
|
18
|
+
= content_for(:nav_tabs)
|
19
|
+
- elsif @admix_tabs
|
20
|
+
- @admix_tabs.each do |tab|
|
21
|
+
= tab.header
|
22
|
+
.tab-content.well
|
23
|
+
- if content_for?(:tabs_content)
|
24
|
+
= content_for(:tabs_content)
|
25
|
+
- elsif @admix_tabs
|
26
|
+
- @admix_tabs.each do |tab|
|
27
|
+
.tab-pane{id: tab.tab_id, class: (tab.options[:first] ? 'active' : '')}
|
28
|
+
.span12
|
29
|
+
.row-fluid
|
30
|
+
= tab.content
|
31
|
+
.span4
|
32
|
+
%ul.nav.nav-list.well
|
33
|
+
%li
|
34
|
+
.div
|
35
|
+
= f.button :submit, class: 'btn-primary'
|
36
|
+
= link_to t('admix.crud.cancel'), collection_url, class: 'btn'
|
37
|
+
- if not resource.nil? and not resource.new_record?
|
38
|
+
= link_destroy(resource, t('admix.crud.destroy.link'), 'btn-danger')
|
39
|
+
- if content_for?(:form_options)
|
40
|
+
%li.nav-header Opções
|
41
|
+
%li
|
42
|
+
= content_for(:form_options)
|
43
|
+
|
44
|
+
|
45
|
+
= content_for(:after_inner_form)
|
46
|
+
= content_for(:after_form)
|
47
|
+
:coffeescript
|
48
|
+
$('#admix_form_tabs a').click (e) ->
|
49
|
+
e.preventDefault()
|
50
|
+
$(this).tab('show')
|
@@ -4,9 +4,10 @@
|
|
4
4
|
%meta{:charset => "utf-8"}
|
5
5
|
%meta{:content => "noindex, nofollow", :name => "robots"}
|
6
6
|
%meta{:name => 'viewport', :content => "width=device-width, initial-scale=1.0"}
|
7
|
-
%title= app_title
|
7
|
+
%title= "Admix | #{app_title}"
|
8
8
|
= stylesheet_link_tag "admix/application", :media => "all"
|
9
9
|
= yield :stylesheets
|
10
|
+
= yield :top_javascripts
|
10
11
|
%script
|
11
12
|
var HOST_NAME = "#{request.protocol + request.host_with_port}";
|
12
13
|
var ROOT_PATH = HOST_NAME + "#{root_path.chomp("/")}";
|
@@ -14,7 +15,6 @@
|
|
14
15
|
= yield :javascripts
|
15
16
|
= csrf_meta_tags
|
16
17
|
%body
|
17
|
-
|
18
18
|
/ Top
|
19
19
|
.container-fluid
|
20
20
|
.navbar.navbar-inverse
|
data/config/admix_navigation.rb
CHANGED
@@ -1,59 +1,44 @@
|
|
1
|
-
# Default menus
|
2
|
-
|
3
|
-
# Clear menus
|
4
|
-
# TODO don't let add repeated menu keys
|
5
|
-
Admix::Navigation::NavBar.clear!
|
6
|
-
|
7
|
-
# Dashboard
|
8
|
-
dashboard = Admix::Navigation::Menu.new
|
9
|
-
dashboard.key = :dashboard
|
10
|
-
dashboard.title = t 'dashboard.dashboard'
|
11
|
-
dashboard.url = admix_root_url
|
12
|
-
dashboard.icon = 'icon-flag'
|
13
|
-
|
14
|
-
# General
|
15
|
-
if current_user.has_role? :admin
|
16
|
-
general = Admix::Navigation::Menu.new
|
17
|
-
general.key = :general
|
18
|
-
general.title = t 'general.general'
|
19
|
-
general.url = 'javascript:;'
|
20
|
-
general.icon = 'icon-flag'
|
21
|
-
end
|
22
|
-
|
23
|
-
# Content
|
24
|
-
content = Admix::Navigation::Menu.new
|
25
|
-
content.key = :content
|
26
|
-
content.title = t 'content.content'
|
27
|
-
content.url = 'javascript:;'
|
28
|
-
content.icon = 'icon-flag'
|
29
|
-
|
30
|
-
Admix::Navigation::NavBar.add dashboard, general, content
|
31
|
-
|
32
|
-
Admix::Navigation::NavBar.insert_post_menus
|
33
|
-
|
34
|
-
# Add menus in navigation bar
|
35
1
|
SimpleNavigation::Configuration.run do |navigation|
|
36
2
|
navigation.items do |primary|
|
37
3
|
primary.dom_class = 'nav'
|
38
4
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
menu.children.each do |submenu|
|
45
|
-
if submenu.respond_to?(:can_render?)
|
46
|
-
if submenu.can_render?(current_user)
|
47
|
-
sec.item submenu.key, submenu.title, send(submenu.url)
|
48
|
-
end
|
49
|
-
else
|
50
|
-
sec.item submenu.key, submenu.title, send(submenu.url)
|
51
|
-
end
|
5
|
+
build_menu = lambda { |pri, activemenu|
|
6
|
+
block = if activemenu.children.length > 0
|
7
|
+
Proc.new { |sub|
|
8
|
+
activemenu.children.each do |c|
|
9
|
+
build_menu.call(sub, c)
|
52
10
|
end
|
53
|
-
|
11
|
+
}
|
12
|
+
else
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
|
16
|
+
href = if activemenu.href.kind_of?(Proc)
|
17
|
+
instance_eval(&activemenu.href)
|
18
|
+
else
|
19
|
+
activemenu.href
|
20
|
+
end
|
21
|
+
|
22
|
+
text = if activemenu.text.kind_of?(Proc)
|
23
|
+
instance_eval(&activemenu.text)
|
54
24
|
else
|
55
|
-
|
25
|
+
activemenu.text
|
56
26
|
end
|
27
|
+
visible = if activemenu.visible.kind_of?(Proc)
|
28
|
+
instance_eval(&activemenu.visible)
|
29
|
+
else
|
30
|
+
activemenu.visible
|
31
|
+
end
|
32
|
+
|
33
|
+
if visible
|
34
|
+
pri.item "activemenu-#{activemenu.id}", text, href, &block
|
35
|
+
end
|
36
|
+
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
ActiveMenu::get('admix-nav').children.each do |menu|
|
41
|
+
build_menu.call(primary, menu)
|
57
42
|
end
|
58
43
|
|
59
44
|
end
|
data/config/application.rb
CHANGED
@@ -2,8 +2,6 @@ config.assets.paths << "#{ Rails.root }/app/assets/bootstrap"
|
|
2
2
|
config.assets.paths << "#{ Rails.root }/app/assets/tipsy"
|
3
3
|
config.assets.paths << "#{ Rails.root }/app/assets/nicedit"
|
4
4
|
|
5
|
-
config.i18n.default_locale = "pt-BR"
|
6
|
-
|
7
5
|
#4. If you are deploying Rails 3.1 on Heroku, you may want to set:
|
8
6
|
#
|
9
7
|
# config.assets.initialize_on_precompile = false
|
@@ -0,0 +1,142 @@
|
|
1
|
+
if defined?(Wice::Defaults)
|
2
|
+
|
3
|
+
# Default number of rows to show per page.
|
4
|
+
Wice::Defaults::PER_PAGE = 20
|
5
|
+
|
6
|
+
# Default order direction
|
7
|
+
Wice::Defaults::ORDER_DIRECTION = 'asc'
|
8
|
+
|
9
|
+
# Default name for a grid. A grid name is the basis for a lot of
|
10
|
+
# names including parameter names, DOM IDs, etc
|
11
|
+
# The shorter the name is the shorter the request URI will be.
|
12
|
+
Wice::Defaults::GRID_NAME = 'grid'
|
13
|
+
|
14
|
+
# If REUSE_LAST_COLUMN_FOR_FILTER_ICONS is true and the last column doesn't have any filter and column name, it will be used
|
15
|
+
# for filter related icons (filter icon, reset icon, show/hide icon), otherwise an additional table column is added.
|
16
|
+
Wice::Defaults::REUSE_LAST_COLUMN_FOR_FILTER_ICONS = true
|
17
|
+
|
18
|
+
# The label of the first option of a custom dropdown list meaning 'All items'
|
19
|
+
Wice::Defaults::CUSTOM_FILTER_ALL_LABEL = '--'
|
20
|
+
|
21
|
+
# A list of classes for the table tag of the grid
|
22
|
+
Wice::Defaults::DEFAULT_TABLE_CLASSES = ['table', 'table-bordered', 'table-striped']
|
23
|
+
|
24
|
+
# Allow switching between a single and multiple selection modes in custom filters (dropdown boxes)
|
25
|
+
Wice::Defaults::ALLOW_MULTIPLE_SELECTION = true
|
26
|
+
|
27
|
+
# Show the upper pagination panel by default or not
|
28
|
+
Wice::Defaults::SHOW_UPPER_PAGINATION_PANEL = false
|
29
|
+
|
30
|
+
# Disabling CSV export by default
|
31
|
+
Wice::Defaults::ENABLE_EXPORT_TO_CSV = false
|
32
|
+
|
33
|
+
# Default CSV field separator
|
34
|
+
Wice::Defaults::CSV_FIELD_SEPARATOR = ','
|
35
|
+
|
36
|
+
|
37
|
+
# The strategy when to show the filter.
|
38
|
+
# * <tt>:when_filtered</tt> - when the table is the result of filtering
|
39
|
+
# * <tt>:always</tt> - show the filter always
|
40
|
+
# * <tt>:no</tt> - never show the filter
|
41
|
+
Wice::Defaults::SHOW_FILTER = :always
|
42
|
+
|
43
|
+
# A boolean value specifying if a change in a filter triggers reloading of the grid.
|
44
|
+
Wice::Defaults::AUTO_RELOAD = false
|
45
|
+
|
46
|
+
|
47
|
+
# SQL operator used for matching strings in string filters.
|
48
|
+
Wice::Defaults::STRING_MATCHING_OPERATOR = 'LIKE'
|
49
|
+
# STRING_MATCHING_OPERATOR = 'ILIKE' # Use this for Postgresql case-insensitive matching.
|
50
|
+
|
51
|
+
|
52
|
+
# Defining one string matching operator globally for the whole application turns is not enough
|
53
|
+
# when you connect to two databases one of which is MySQL and the other is Postgresql.
|
54
|
+
# If the key for an adapter is missing it will fall back to Wice::Defaults::STRING_MATCHING_OPERATOR
|
55
|
+
Wice::Defaults::STRING_MATCHING_OPERATORS = {
|
56
|
+
'ActiveRecord::ConnectionAdapters::MysqlAdapter' => 'LIKE',
|
57
|
+
'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' => 'ILIKE'
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
63
|
+
# Advanced Filters #
|
64
|
+
|
65
|
+
# Switch of the negation checkbox in all text filters
|
66
|
+
Wice::Defaults::NEGATION_IN_STRING_FILTERS = false
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
71
|
+
# Showing All Queries #
|
72
|
+
|
73
|
+
# Enable or disable showing all queries (non-paginated table)
|
74
|
+
Wice::Defaults::ALLOW_SHOWING_ALL_QUERIES = true
|
75
|
+
|
76
|
+
# If number of all queries is more than this value, the user will be given a warning message
|
77
|
+
Wice::Defaults::START_SHOWING_WARNING_FROM = 100
|
78
|
+
|
79
|
+
|
80
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
81
|
+
# Saving Queries #
|
82
|
+
|
83
|
+
# ActiveRecord model to store queries. Read the documentation for details
|
84
|
+
# QUERY_STORE_MODEL = 'WiceGridSerializedQuery'
|
85
|
+
Wice::Defaults::QUERY_STORE_MODEL = 'WiceGridSerializedQuery'
|
86
|
+
|
87
|
+
|
88
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
89
|
+
# Here go settings related to the calendar helpers #
|
90
|
+
|
91
|
+
# The default style of the date and datetime helper
|
92
|
+
# * <tt>:calendar</tt> - JS calendar
|
93
|
+
# * <tt>:standard</tt> - standard Rails date and datetime helpers
|
94
|
+
Wice::Defaults::HELPER_STYLE = :calendar
|
95
|
+
|
96
|
+
# Format of the datetime displayed.
|
97
|
+
# If you change the format, make sure to check if +DATETIME_PARSER+ can still parse this string.
|
98
|
+
Wice::Defaults::DATETIME_FORMAT = "%Y-%m-%d %H:%M"
|
99
|
+
|
100
|
+
# Format of the date displayed.
|
101
|
+
# If you change the format, make sure to check if +DATE_PARSER+ can still parse this string.
|
102
|
+
Wice::Defaults::DATE_FORMAT = "%Y-%m-%d"
|
103
|
+
|
104
|
+
# Format of the date displayed in jQuery's Datepicker
|
105
|
+
# If you change the format, make sure to check if +DATE_PARSER+ can still parse this string.
|
106
|
+
Wice::Defaults::DATE_FORMAT_JQUERY = "dd/mm/yy"
|
107
|
+
|
108
|
+
|
109
|
+
# With Calendar helpers enabled the parameter sent is the string displayed. This lambda will be given a date string in the
|
110
|
+
# format defined by +DATETIME_FORMAT+ and must generate a DateTime object.
|
111
|
+
# In many cases <tt>Time.zone.parse</tt> is enough, for instance, <tt>%Y-%m-%d</tt>. If you change the format, make sure to check this code
|
112
|
+
# and modify it if needed.
|
113
|
+
Wice::Defaults::DATETIME_PARSER = lambda{|datetime_string|
|
114
|
+
if datetime_string.blank?
|
115
|
+
nil
|
116
|
+
elsif Time.zone
|
117
|
+
Time.zone.parse(datetime_string)
|
118
|
+
else
|
119
|
+
Time.parse(datetime_string)
|
120
|
+
end
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
# With Calendar helpers enabled the parameter sent is the string displayed. This lambda will be given a date string in the
|
125
|
+
# format defined by +DATETIME+ and must generate a Date object.
|
126
|
+
# In many cases <tt>Date.parse</tt> is enough, for instance, <tt>%Y-%m-%d</tt>. If you change the format, make sure to check this code
|
127
|
+
# and modify it if needed.
|
128
|
+
Wice::Defaults::DATE_PARSER = lambda{|date_string|
|
129
|
+
if date_string.blank?
|
130
|
+
nil
|
131
|
+
else
|
132
|
+
Date.parse(date_string)
|
133
|
+
end
|
134
|
+
}
|
135
|
+
|
136
|
+
# Icon to popup the calendar.
|
137
|
+
Wice::Defaults::CALENDAR_ICON = "/assets/icons/grid/calendar_view_month.png"
|
138
|
+
|
139
|
+
# popup calendar will be shown relative to the popup trigger element or to the mouse pointer
|
140
|
+
Wice::Defaults::POPUP_PLACEMENT_STRATEGY = :trigger # :pointer
|
141
|
+
|
142
|
+
end
|