tida_conte_template 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/README.md +29 -0
  2. data/lib/breadcrumbs_renderer.rb +23 -0
  3. data/lib/generators/tida_conte_template/install_generator.rb +28 -0
  4. data/lib/generators/tida_conte_template/templates/erb/scaffold/_form.html.erb +18 -0
  5. data/lib/generators/tida_conte_template/templates/erb/scaffold/edit.html.erb +3 -0
  6. data/lib/generators/tida_conte_template/templates/erb/scaffold/index.html.erb +22 -0
  7. data/lib/generators/tida_conte_template/templates/erb/scaffold/new.html.erb +3 -0
  8. data/lib/generators/tida_conte_template/templates/erb/scaffold/show.html.erb +24 -0
  9. data/lib/generators/tida_conte_template/templates/layout.html.erb +58 -0
  10. data/lib/generators/tida_conte_template/templates/navigation_renderers.rb +2 -0
  11. data/lib/generators/tida_conte_template/templates/shared/_breadcrumbs.html.erb +3 -0
  12. data/lib/generators/tida_conte_template/templates/shared/_notification.html.erb +12 -0
  13. data/lib/generators/tida_conte_template/templates/shared/_page_toolbar.html.erb +15 -0
  14. data/lib/generators/tida_conte_template/templates/simple_navigation.rb +75 -0
  15. data/lib/generators/tida_conte_template/templates/single.html.erb +34 -0
  16. data/lib/generators/tida_conte_template/templates/wice_grid_config.rb +142 -0
  17. data/lib/generators/tida_conte_template/templates/wice_grid_local.yml +502 -0
  18. data/lib/navigation_renderer.rb +59 -0
  19. data/lib/tida_conte_template.rb +8 -0
  20. data/lib/tida_conte_template/version.rb +3 -0
  21. data/vendor/assets/images/app_logo.png +0 -0
  22. data/vendor/assets/images/breadcrumb_bg.png +0 -0
  23. data/vendor/assets/images/login_logo.png +0 -0
  24. data/vendor/assets/javascripts/bootstrap-datetimepicker.min.js +26 -0
  25. data/vendor/assets/javascripts/conte.js +33 -0
  26. data/vendor/assets/stylesheets/bootstrap-datetimepicker.min.css +8 -0
  27. data/vendor/assets/stylesheets/bootstrap-overwrite.css.scss +125 -0
  28. data/vendor/assets/stylesheets/conte.css.scss +269 -0
  29. data/vendor/assets/stylesheets/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  30. data/vendor/assets/stylesheets/jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  31. data/vendor/assets/stylesheets/jquery-ui/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  32. data/vendor/assets/stylesheets/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  33. data/vendor/assets/stylesheets/jquery-ui/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  34. data/vendor/assets/stylesheets/jquery-ui/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  35. data/vendor/assets/stylesheets/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  36. data/vendor/assets/stylesheets/jquery-ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  37. data/vendor/assets/stylesheets/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
  38. data/vendor/assets/stylesheets/jquery-ui/images/ui-icons_2e83ff_256x240.png +0 -0
  39. data/vendor/assets/stylesheets/jquery-ui/images/ui-icons_454545_256x240.png +0 -0
  40. data/vendor/assets/stylesheets/jquery-ui/images/ui-icons_888888_256x240.png +0 -0
  41. data/vendor/assets/stylesheets/jquery-ui/images/ui-icons_cd0a0a_256x240.png +0 -0
  42. data/vendor/assets/stylesheets/jquery-ui/jquery-ui-1.10.0.custom.min.css +5 -0
  43. data/vendor/assets/stylesheets/single.css.scss +49 -0
  44. data/vendor/assets/stylesheets/wice_grid.css.scss +139 -0
  45. metadata +169 -0
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Tida - Conte Template
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'tida_conte_template'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install tida_conte_template
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,23 @@
1
+ require "simple_navigation"
2
+
3
+ module TidaConteTemplate
4
+ class BreadcrumbsRenderer < ::SimpleNavigation::Renderer::Base
5
+ def render(item_container)
6
+ a_tags(item_container).join.html_safe
7
+ end
8
+
9
+ protected
10
+
11
+ def a_tags(item_container)
12
+ item_container.items.inject([]) do |list, item|
13
+ if item.selected?
14
+ list << content_tag(:li, tag_for(item)) if item.selected?
15
+ if include_sub_navigation?(item)
16
+ list.concat a_tags(item.sub_navigation)
17
+ end
18
+ end
19
+ list
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ module TidaConteTemplate #:nodoc:
2
+ module Generators #:nodoc:
3
+ class InstallGenerator < Rails::Generators::Base #:nodoc:
4
+
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ def copy_stuff #:nodoc:
8
+ copy_file 'layout.html.erb', 'app/views/layouts/application.html.erb'
9
+ copy_file 'single.html.erb', 'app/views/layouts/single.html.erb'
10
+ copy_file 'navigation_renderers.rb', 'config/initializers/conte_navigation_renderers.rb'
11
+ copy_file 'simple_navigation.rb', 'config/navigation.rb'
12
+ copy_file 'wice_grid_config.rb', 'config/initializers/wice_grid_config.rb'
13
+ copy_file 'wice_grid_local.yml', 'config/locales/wice_grid.yml'
14
+
15
+ copy_file 'shared/_breadcrumbs.html.erb', 'app/views/shared/_breadcrumbs.html.erb'
16
+ copy_file 'shared/_notification.html.erb', 'app/views/shared/_notification.html.erb'
17
+ copy_file 'shared/_page_toolbar.html.erb', 'app/views/shared/_page_toolbar.html.erb'
18
+
19
+ copy_file 'erb/scaffold/_form.html.erb', 'lib/templates/erb/scaffold/_form.html.erb'
20
+ copy_file 'erb/scaffold/edit.html.erb', 'lib/templates/erb/scaffold/edit.html.erb'
21
+ copy_file 'erb/scaffold/index.html.erb', 'lib/templates/erb/scaffold/index.html.erb'
22
+ copy_file 'erb/scaffold/new.html.erb', 'lib/templates/erb/scaffold/new.html.erb'
23
+ copy_file 'erb/scaffold/show.html.erb', 'lib/templates/erb/scaffold/show.html.erb'
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ <%% content_for :right_page_toolbar do %>
2
+ <%%= link_to(render_icon_and_text_content('icon-circle-arrow-left', "#{t('labels.back_to')}#{t('model.list', :model => <%= class_name.split('::').last %>.model_name.human)}"), <%= plural_table_name %>_path, class: 'btn btn-inverse') %>
3
+ <%% end %>
4
+
5
+ <%%= simple_form_for(@<%= singular_table_name %>, :html => {:class => 'form-horizontal' }) do |f| %>
6
+ <%%= f.error_notification %>
7
+
8
+ <div class="form-inputs">
9
+ <%- attributes.each do |attribute| -%>
10
+ <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
11
+ <%- end -%>
12
+ </div>
13
+
14
+ <div class="form-actions">
15
+ <%%= f.button :submit, class: 'btn btn-inverse' %>
16
+ </div>
17
+ <%% end %>
18
+
@@ -0,0 +1,3 @@
1
+ <div id="content">
2
+ <%%= render 'form' %>
3
+ </div>
@@ -0,0 +1,22 @@
1
+ <%% content_for :right_page_toolbar do %>
2
+ <%%= link_to(render_icon_and_text_content('icon-plus-sign', t('model.create', :model => <%= class_name.split('::').last %>.model_name.human)), new_<%= class_name.split('::').last.underscore.downcase %>_path, :class => 'btn btn-inverse') %>
3
+ <%% end %>
4
+
5
+ <div id="content">
6
+
7
+ <%%= grid(@<%= class_name.split('::').last.underscore.downcase.pluralize %>_grid, :show_filters => :always) do |g|
8
+ <% attributes.each do |attribute| -%>
9
+ g.column :name => t('activerecord.attributes.<%= class_name.split('::').last.underscore.downcase %>.<%= attribute.name %>'), :html => {:class => "grid-cell"} do |<%= class_name.split('::').last.underscore.downcase %>|
10
+ <%= class_name.split('::').last.underscore.downcase %>.<%= attribute.name %>
11
+ end
12
+ <% end -%>
13
+
14
+ g.column :html => {:style => "width:50px;"} do |<%= class_name.split('::').last.underscore.downcase %>|
15
+ content = []
16
+ content << link_to(render_icon_content('icon-edit'), edit_<%= singular_table_name %>_path(<%= class_name.split('::').last.underscore.downcase %>), :class => 'btn btn-link', :rel => 'tooltip', :title => t('buttons.edit'))
17
+ content << link_to(render_icon_content('icon-trash'), <%= singular_table_name %>_path(<%= class_name.split('::').last.underscore.downcase %>), :method => :delete, :confirm => t("confirms.delete"), :class => 'btn btn-link', :rel => 'tooltip', :title => t('buttons.delete'))
18
+ content_tag :div, content.join('').html_safe, class: 'btn-group'
19
+ end
20
+ end -%>
21
+
22
+ </div>
@@ -0,0 +1,3 @@
1
+ <div id="content">
2
+ <%%= render 'form' %>
3
+ </div>
@@ -0,0 +1,24 @@
1
+ <div class="page-header">
2
+ <div class="row">
3
+ <div class="span8">
4
+ <h2><%%= t("model.show", :model => <%= class_name.split('::').last %>.model_name.human) %></h2>
5
+ </div>
6
+
7
+ <div class="btn-group pull-right">
8
+
9
+ </div>
10
+
11
+ </div>
12
+ </div>
13
+
14
+ <p id="notice"><%%= notice %></p>
15
+
16
+ <% attributes.each do |attribute| -%>
17
+ <p>
18
+ <strong><%= attribute.human_name %>:</strong>
19
+ <%%= @<%= class_name.split('::').last.underscore.downcase %>.<%= attribute.name %> %>
20
+ </p>
21
+
22
+ <% end -%>
23
+
24
+ <%%= link_to "#{t('labels.back_to')}#{t('model.list', :model => <%= class_name.split('::').last %>)}", <%= index_helper %>_path %>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Conte</title>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <%= stylesheet_link_tag "application", :media => "all" %>
7
+ <%= javascript_include_tag "application" %>
8
+ <%= yield :js %>
9
+ <%= csrf_meta_tags %>
10
+ </head>
11
+ <body>
12
+ <div id="page" class="container-fluid">
13
+ <div class="row-fluid">
14
+ <div id="sidebar" class="span2">
15
+ <div id="logo-bg">
16
+ <div id="logo"></div>
17
+ </div>
18
+ <%= render_navigation(level: 1..2, renderer: :navigation_renderer, expand_all: true) %>
19
+ </div>
20
+ <div id="main" class="span10">
21
+ <div id="header">
22
+ <div class="container-fluid">
23
+ <div class="row-fluid">
24
+ <div class="span6">
25
+ <%= render :partial => 'shared/breadcrumbs' %>
26
+ </div>
27
+ <div class="span6">
28
+ <ul class="nav pull-right user-section">
29
+ <%- if user_signed_in? %>
30
+ <li class="dropdown">
31
+ <a href="javascript:void(0);" class="dropdown-toggle"><%= t("labels.welcome")%>, <strong><%= current_user.email %></strong> <b class="caret"></b></a>
32
+ <ul class="dropdown-menu">
33
+ <li>
34
+ <%= link_to(t("buttons.sign_out"), destroy_user_session_path, :method=>'delete') %>
35
+ </li>
36
+ </ul>
37
+ </li>
38
+ <% else %>
39
+ <li><%= link_to t("buttons.sign_in"), :user_session %></li>
40
+ <% end -%>
41
+ </ul>
42
+ </div>
43
+ </div>
44
+ </div>
45
+
46
+ </div>
47
+
48
+ <%= render :partial => 'shared/page_toolbar' %>
49
+
50
+ <%= render :partial => 'shared/notification' %>
51
+
52
+ <%= yield %>
53
+ </div>
54
+ </div>
55
+ </div>
56
+
57
+ </body>
58
+ </html>
@@ -0,0 +1,2 @@
1
+ SimpleNavigation.register_renderer :navigation_renderer => TidaConteTemplate::NavigationRenderer
2
+ SimpleNavigation.register_renderer :breadcrumbs_renderer => TidaConteTemplate::BreadcrumbsRenderer
@@ -0,0 +1,3 @@
1
+ <ul class="breadcrumbs">
2
+ <%= render_navigation(level: 1..2, renderer: :breadcrumbs_renderer) %>
3
+ </ul>
@@ -0,0 +1,12 @@
1
+ <%- if alert %>
2
+ <div class="alert alert-error">
3
+ <button type="button" class="close" data-dismiss="alert">&times;</button>
4
+ <strong>Error!</strong><%= alert %>
5
+ </div>
6
+ <% end -%>
7
+ <%- if notice %>
8
+ <div class="alert alert-success">
9
+ <button type="button" class="close" data-dismiss="alert">&times;</button>
10
+ <%= notice %>
11
+ </div>
12
+ <% end -%>
@@ -0,0 +1,15 @@
1
+ <div id="page-toolbar" class="container-fluid">
2
+ <div class="row-fluid">
3
+ <div class="span4" id="left-page-toolbar">
4
+ <%= yield :left_page_toolbar %>
5
+ </div>
6
+ <div class="span4" id="center-page-toolbar">
7
+ <%= yield :center_page_toolbar %>
8
+ </div>
9
+ <div class="span4" id="right-page-toolbar">
10
+ <div class="btn-toolbar pull-right">
11
+ <%= yield :right_page_toolbar %>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ </div>
@@ -0,0 +1,75 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Configures your navigation
3
+ SimpleNavigation::Configuration.run do |navigation|
4
+ # Specify a custom renderer if needed.
5
+ # The default renderer is SimpleNavigation::Renderer::List which renders HTML lists.
6
+ # The renderer can also be specified as option in the render_navigation call.
7
+ # navigation.renderer = Your::Custom::Renderer
8
+
9
+ # Specify the class that will be applied to active navigation items. Defaults to 'selected'
10
+ navigation.selected_class = 'active'
11
+
12
+ # Specify the class that will be applied to the current leaf of
13
+ # active navigation items. Defaults to 'simple-navigation-active-leaf'
14
+ navigation.active_leaf_class = nil
15
+
16
+ # Item keys are normally added to list items as id.
17
+ # This setting turns that off
18
+ navigation.autogenerate_item_ids = false
19
+
20
+ # You can override the default logic that is used to autogenerate the item ids.
21
+ # To do this, define a Proc which takes the key of the current item as argument.
22
+ # The example below would add a prefix to each key.
23
+ # navigation.id_generator = Proc.new {|key| "my-prefix-#{key}"}
24
+
25
+ # If you need to add custom html around item names, you can define a proc that will be called with the name you pass in to the navigation.
26
+ # The example below shows how to wrap items spans.
27
+ # navigation.name_generator = Proc.new {|name| "<span>#{name}</span>"}
28
+
29
+ # The auto highlight feature is turned on by default.
30
+ # This turns it off globally (for the whole plugin)
31
+ # navigation.auto_highlight = false
32
+
33
+ # Define the primary navigation
34
+ navigation.items do |primary|
35
+ # Add an item to the primary navigation. The following params apply:
36
+ # key - a symbol which uniquely defines your navigation item in the scope of the primary_navigation
37
+ # name - will be displayed in the rendered navigation. This can also be a call to your I18n-framework.
38
+ # url - the address that the generated item links to. You can also use url_helpers (named routes, restful routes helper, url_for etc.)
39
+ # options - can be used to specify attributes that will be included in the rendered navigation item (e.g. id, class etc.)
40
+ # some special options that can be set:
41
+ # :if - Specifies a proc to call to determine if the item should
42
+ # be rendered (e.g. <tt>:if => Proc.new { current_user.admin? }</tt>). The
43
+ # proc should evaluate to a true or false value and is evaluated in the context of the view.
44
+ # :unless - Specifies a proc to call to determine if the item should not
45
+ # be rendered (e.g. <tt>:unless => Proc.new { current_user.admin? }</tt>). The
46
+ # proc should evaluate to a true or false value and is evaluated in the context of the view.
47
+ # :method - Specifies the http-method for the generated link - default is :get.
48
+ # :highlights_on - if autohighlighting is turned off and/or you want to explicitly specify
49
+ # when the item should be highlighted, you can set a regexp which is matched
50
+ # against the current URI. You may also use a proc, or the symbol <tt>:subpath</tt>.
51
+ #
52
+ primary.item :key_1, 'name', url, options
53
+
54
+ # Add an item which has a sub navigation (same params, but with block)
55
+ primary.item :key_2, 'name', url, options do |sub_nav|
56
+ # Add an item to the sub navigation (same params again)
57
+ sub_nav.item :key_2_1, 'name', url, options
58
+ end
59
+
60
+ # You can also specify a condition-proc that needs to be fullfilled to display an item.
61
+ # Conditions are part of the options. They are evaluated in the context of the views,
62
+ # thus you can use all the methods and vars you have available in the views.
63
+ primary.item :key_3, 'Admin', url, :class => 'special', :if => Proc.new { current_user.admin? }
64
+ primary.item :key_4, 'Account', url, :unless => Proc.new { logged_in? }
65
+
66
+ # you can also specify a css id or class to attach to this particular level
67
+ # works for all levels of the menu
68
+ # primary.dom_id = 'menu-id'
69
+ # primary.dom_class = 'menu-class'
70
+
71
+ # You can turn off auto highlighting for a specific level
72
+ # primary.auto_highlight = false
73
+ end
74
+
75
+ end
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= Settings.app.name %></title>
5
+ <%= stylesheet_link_tag "single", :media => "all" %>
6
+
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+ <div id="page" class="container-fluid">
11
+ <div class="row-fluid">
12
+ <div class="span4"></div>
13
+ <div class="span4">
14
+ <%- if controller_name != 'sessions' %>
15
+ <%= link_to t('buttons.sign_in'), new_session_path(resource_name) %><br />
16
+ <% end -%>
17
+ </div>
18
+ </div>
19
+ <div class="row-fluid">
20
+ <div class="span4">
21
+ <div id="logo">
22
+ </div>
23
+ </div>
24
+ <div class="span6">
25
+ <div id="main">
26
+ <%= render :partial => 'shared/notification' %>
27
+ <%= yield %>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ </body>
34
+ </html>
@@ -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-striped', 'table-bordered', 'table-hover']
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 = "yy-mm-dd"
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