redmine_extensions 0.1.05 → 0.1.06

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/redmine_extensions/easy_togglers.js +64 -0
  3. data/app/assets/javascripts/redmine_extensions/redmine_extensions.js +1 -1
  4. data/app/helpers/redmine_extensions/application_helper.rb +2 -2
  5. data/app/views/common/_closing_modal.html.erb +2 -2
  6. data/app/views/common/_collapsible_module_layout.html.erb +2 -2
  7. data/app/views/common/close_modal.js.erb +4 -4
  8. data/config/locales/en.yml +1 -0
  9. data/lib/generators/redmine_extensions/entity/entity_generator.rb +4 -0
  10. data/lib/generators/redmine_extensions/entity/templates/_sidebar.html.erb.erb +8 -8
  11. data/lib/generators/redmine_extensions/entity/templates/context_menu.html.erb.erb +7 -7
  12. data/lib/generators/redmine_extensions/entity/templates/controller.rb.erb +1 -0
  13. data/lib/generators/redmine_extensions/entity/templates/custom_field.rb.erb +7 -7
  14. data/lib/generators/redmine_extensions/entity/templates/edit.html.erb.erb +18 -18
  15. data/lib/generators/redmine_extensions/entity/templates/edit.js.erb.erb +16 -16
  16. data/lib/generators/redmine_extensions/entity/templates/index.api.rsb.erb +5 -5
  17. data/lib/generators/redmine_extensions/entity/templates/index.html.erb.erb +4 -4
  18. data/lib/generators/redmine_extensions/entity/templates/index.js.erb.erb +11 -0
  19. data/lib/generators/redmine_extensions/entity/templates/mail_added.html.erb.erb +1 -1
  20. data/lib/generators/redmine_extensions/entity/templates/mail_added.text.erb.erb +2 -2
  21. data/lib/generators/redmine_extensions/entity/templates/mail_updated.text.erb.erb +2 -2
  22. data/lib/generators/redmine_extensions/entity/templates/migration.rb.erb +9 -9
  23. data/lib/generators/redmine_extensions/entity/templates/new.html.erb.erb +18 -18
  24. data/lib/generators/redmine_extensions/entity/templates/new.js.erb.erb +16 -16
  25. data/lib/generators/redmine_extensions/entity/templates/routes.rb.erb +12 -12
  26. data/lib/generators/redmine_extensions/entity/templates/show.html.erb.erb +37 -37
  27. data/lib/generators/redmine_extensions/entity/templates/show.js.erb.erb +11 -0
  28. data/lib/redmine_extensions/easy_query_adapter.rb +11 -11
  29. data/lib/redmine_extensions/easy_query_helpers/outputs.rb +8 -0
  30. data/lib/redmine_extensions/hooks.rb +8 -2
  31. data/lib/redmine_extensions/query_output.rb +2 -1
  32. data/lib/redmine_extensions/version.rb +1 -1
  33. data/spec/redmine/bin/about +0 -0
  34. data/spec/redmine/bin/bundle +0 -0
  35. data/spec/redmine/bin/rails +0 -0
  36. data/spec/redmine/bin/rake +0 -0
  37. data/spec/redmine/extra/svn/reposman.rb +0 -0
  38. data/spec/redmine/public/dispatch.fcgi.example +0 -0
  39. data/spec/redmine/script/about +0 -0
  40. data/spec/redmine/script/rails +0 -0
  41. metadata +1963 -1960
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5db9a307843534efd5b78eb74983f18ed76bb6e4
4
- data.tar.gz: b4d307b3969ea6ba5d8f9547054ed5e3dda480b2
3
+ metadata.gz: 3e093b401bd8e9030fb667cc3ee17f32d7b204ae
4
+ data.tar.gz: 2c03e7b6d5233b7804a511a44f3ad8833815baf3
5
5
  SHA512:
6
- metadata.gz: f60499c0b0c62af6d2964afdb42a543dd3095bcb50fe8b936fcfa15a1e7f02a5f41da520577d736e27bf8c8b7a873cd1a769fe9b76d01674725792baf8aa00cb
7
- data.tar.gz: 3ce2eb9ca5e081fd5f4da418c365ba1aae7c3b1c52aae0d36affd15a9622d4b70b77cd9fb2aa5631ac575edc49bb581341a396684f4454847873722d5335d882
6
+ metadata.gz: 3c2af4a97686848fa68fee1c1838ce1336b286199743628d6e36a255a12766bb288f84630058e01a9e7b172ec870f743e4e275d700c7fcc1f217caa98ba51f00
7
+ data.tar.gz: faeabac2e260c99131f41788900206736b680936358c253d4ef488f467cfa1c24ed33a127055761af881d82583acaabd3a23dd664b485280424523763a597f3e
@@ -0,0 +1,64 @@
1
+ var EasyToggler = new function() {
2
+ // EasyToggler storage store object where key is ID of container and value is 0 - for hidden default state or 1 - for shown default state
3
+ // Example:
4
+ // localStorage # => {"easy-toggle-state": {myDiv: 0, history: 1}} # where myDiv is by default hidden, and now will be shown as visible and history is vice versa
5
+
6
+ var storage = JSON.parse(localStorage.getItem('easy-toggle-state') || "{}");
7
+
8
+ var save = function() {
9
+ localStorage.setItem('easy-toggle-state', JSON.stringify(storage));
10
+ return storage;
11
+ };
12
+
13
+ var isHidden = function(el) {
14
+ return (el && el.style.display === 'none')
15
+ };
16
+
17
+ var toggle = function(el) {
18
+ var parent = el.parentNode;
19
+
20
+ if (parent.classList.contains("collapsed")) {
21
+ parent.classList.remove("collapsed");
22
+ } else {
23
+ parent.classList.add("collapsed");
24
+ }
25
+ el.style.display = isHidden(el) ? 'block' : 'none';
26
+ !!parent.dataset.toggle && save();
27
+ $( document ).trigger( "erui_interface_change_vertical" ); // <> !#@!
28
+ return el;
29
+ };
30
+
31
+ // Toggle specify element OR this - which is toggler button so toggle element is sibling
32
+ this.toggle = function(id_or_el, event) {
33
+ if (event && event.target.tagName === "A")
34
+ return;
35
+
36
+ var el = (typeof(id_or_el) === "object") ? id_or_el : document.getElementById(id_or_el);
37
+ var id = el.id;
38
+ if (id) {
39
+ if (!!storage[id]) {
40
+ delete storage[id];
41
+ } else {
42
+ storage[id] = isHidden(el) ? 0 : 1;
43
+ }
44
+ toggle(el);
45
+ } else {
46
+ console.warn('Could not toggle this element', el);
47
+ }
48
+
49
+ };
50
+
51
+ this.ensureToggle = function() {
52
+ var list = document.querySelectorAll('*[data-toggle]');
53
+ for (var i = 0; i < list.length; ++i) {
54
+ var item = list.item(i);
55
+ var container = document.getElementById(item.dataset.toggle);
56
+ if (!!storage[item.dataset.toggle]) {
57
+ toggle(container);
58
+ }
59
+ }
60
+ return this;
61
+ };
62
+ };
63
+
64
+ $(document).ready(EasyToggler.ensureToggle);
@@ -494,7 +494,7 @@ window.closeFlashMessage = (function($element){
494
494
  },
495
495
 
496
496
  _initData: function(data) {
497
- this.possibleValues = this._formatData(data)
497
+ this.possibleValues = this._formatData(data);
498
498
  this.valuesLoaded = true;
499
499
 
500
500
  this.selectedValues = this.selectedValues ? this.selectedValues : [];
@@ -116,7 +116,7 @@ module RedmineExtensions
116
116
  # ** Aliases for this options are: wrapping_heading_element, header_tag
117
117
  # * <tt>toggle: false</tt> - This disable toggle function (collapsible and remember)
118
118
  # ** Aliases for this options are: collapsible, no_expander
119
- # * <tt>remember: false</tt> - This disable remember function of toggle conatiner
119
+ # * <tt>remember: false</tt> - This disable remember function of toggle container
120
120
  # ** Aliases for this options are: ajax_call
121
121
  #
122
122
  def render_module_easy_box(id, heading, options = {}, &block) # with fallback to old
@@ -220,7 +220,7 @@ module RedmineExtensions
220
220
 
221
221
  content_tag(:span, :class => 'easy-multiselect-tag-container') do
222
222
  text_field_tag('', '', (options[:html_options] || {}).merge(id: options[:id])) +
223
- javascript_tag("$('##{options[:id]}').easymultiselect({multiple: true, rootElement: #{options[:rootElement]}, inputName: '#{name}', preload: true, source: #{source}, selected: #{selected_values.to_json}, show_toggle_button: #{options[:show_toggle_button]}, select_first_value: #{options[:select_first_value]}, load_immediately: #{options[:load_immediately]}, autocomplete_options: #{(options[:jquery_auto_complete_options]||{}).to_json} });")
223
+ javascript_tag("$('##{options[:id]}').easymultiselect({multiple: true, rootElement: #{options[:rootElement].to_json}, inputName: '#{name}', preload: true, source: #{source}, selected: #{selected_values.to_json}, show_toggle_button: #{options[:show_toggle_button]}, select_first_value: #{options[:select_first_value]}, load_immediately: #{options[:load_immediately]}, autocomplete_options: #{(options[:jquery_auto_complete_options]||{}).to_json} });")
224
224
  end
225
225
  end
226
226
 
@@ -1,3 +1,3 @@
1
- <p>
2
- <%= l(:text_modal_is_closing) %>
1
+ <p>
2
+ <%= l(:text_modal_is_closing) %>
3
3
  </p>
@@ -1,5 +1,5 @@
1
- <div class="module box <%= renderer.container_class %>"<%=raw renderer.collapsible? && %Q{ data-toggle="#{renderer.id}"} || nil %>>
2
- <%= content_tag(:div, class: 'module-heading ' + renderer.heading_class, onclick: (renderer.saving_state_enabled? && 'EasyToggler.toggle(this.nextElementSibling, event)' || nil)) do %>
1
+ <div class="module box <%= renderer.container_class %>"<%=raw renderer.saving_state_enabled? && %Q{ data-toggle="#{renderer.id}"} || nil %>>
2
+ <%= content_tag(:div, class: 'module-heading ' + renderer.heading_class, onclick: (renderer.collapsible? && 'EasyToggler.toggle(this.nextElementSibling, event)' || nil)) do %>
3
3
  <%= content_tag(:span, ' ', class: 'expander module-toggler') if renderer.collapsible? %>
4
4
  <%= content_tag(renderer.heading_tag, renderer.heading, class: renderer.icon) %>
5
5
  <%= content_tag(:span, renderer.heading_links, class: 'module-heading-links') if renderer.heading_links %>
@@ -1,5 +1,5 @@
1
- $("#ajax-modal").html("<%= j render(:partial => 'common/closing_modal', :formats => [:html]) %>");
2
- $("#ajax-modal").dialog('option', {
3
- buttons: []
4
- });
1
+ $("#ajax-modal").html("<%= j render(:partial => 'common/closing_modal', :formats => [:html]) %>");
2
+ $("#ajax-modal").dialog('option', {
3
+ buttons: []
4
+ });
5
5
  window.location = "<%= j params[:back_url] %>";
@@ -1,4 +1,5 @@
1
1
  en:
2
2
  nothing: Nothing
3
3
  button_update_easy_settings: Update settings
4
+ label_no_output: No output has been selected
4
5
  text_modal_is_closing: This modal dialog will be closed automatically, please wait.
@@ -44,6 +44,7 @@ module RedmineExtensions
44
44
  template 'controller.rb.erb', "#{plugin_path}/app/controllers/#{model_name_pluralize_underscored}_controller.rb"
45
45
  template('custom_field.rb.erb', "#{plugin_path}/app/models/#{model_name_underscored}_custom_field.rb") if acts_as_customizable?
46
46
  template 'edit.html.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/edit.html.erb"
47
+ template 'edit.js.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/edit.js.erb"
47
48
 
48
49
  if File.exists?("#{plugin_path}/config/locales/en.yml")
49
50
  append_to_file "#{plugin_path}/config/locales/en.yml" do
@@ -71,6 +72,7 @@ module RedmineExtensions
71
72
  template 'hooks.rb.erb', "#{plugin_path}/lib/#{plugin_name_underscored}/#{model_name_underscored}_hooks.rb"
72
73
  template 'index.api.rsb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/index.api.rsb"
73
74
  template 'index.html.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/index.html.erb"
75
+ template 'index.js.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/index.js.erb"
74
76
 
75
77
  if mail?
76
78
  template 'mailer.rb.erb', "#{plugin_path}/app/models/#{model_name_underscored}_mailer.rb"
@@ -83,6 +85,7 @@ module RedmineExtensions
83
85
  template 'migration.rb.erb', "#{plugin_path}/db/migrate/#{Time.now.strftime('%Y%m%d%H%M%S')}_create_#{@model_name_pluralize_underscored}.rb"
84
86
  template 'model.rb.erb', "#{plugin_path}/app/models/#{model_name_underscored}.rb"
85
87
  template 'new.html.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/new.html.erb"
88
+ template 'new.js.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/new.js.erb"
86
89
  template 'query.rb.erb', "#{plugin_path}/app/models/#{model_name_underscored}_query.rb"
87
90
 
88
91
  if File.exists?("#{plugin_path}/config/routes.rb")
@@ -145,6 +148,7 @@ module RedmineExtensions
145
148
 
146
149
  template 'show.api.rsb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/show.api.rsb"
147
150
  template 'show.html.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/show.html.erb"
151
+ template 'show.js.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/show.js.erb"
148
152
  end
149
153
 
150
154
  private
@@ -1,9 +1,9 @@
1
- <ul>
2
- <%% if @<%= model_name_underscored %> && !@<%= model_name_underscored %>.new_record? %>
3
- <li><%%= link_to l(:button_edit), edit_polymorphic_path([@project, @<%= model_name_underscored %>]), title: l(:button_edit), class: 'icon icon-edit' %></li>
4
- <%% end %>
5
- <%% if @<%= model_name_underscored %>.nil? %>
6
- <li><%%= link_to l(:button_<%= model_name_underscored %>_new), new_polymorphic_path([@project, :<%= model_name_underscored %>]), title: l(:title_<%= model_name_underscored %>_new), class: 'icon icon-add button button-positive' %></li>
7
- <%% end %>
8
- <li><%%= link_to l(:label_<%= model_name_pluralize_underscored %>), polymorphic_path([@project, :<%= model_name_pluralize_underscored %>], set_filter: '1'), title: l(:label_<%= model_name_pluralize_underscored %>), class: 'icon icon-folder button' %></li>
1
+ <ul>
2
+ <%% if @<%= model_name_underscored %> && !@<%= model_name_underscored %>.new_record? %>
3
+ <li><%%= link_to l(:button_edit), edit_polymorphic_path([@project, @<%= model_name_underscored %>]), title: l(:button_edit), class: 'icon icon-edit' %></li>
4
+ <%% end %>
5
+ <%% if @<%= model_name_underscored %>.nil? %>
6
+ <li><%%= link_to l(:button_<%= model_name_underscored %>_new), new_polymorphic_path([@project, :<%= model_name_underscored %>]), title: l(:title_<%= model_name_underscored %>_new), class: 'icon icon-add button button-positive' %></li>
7
+ <%% end %>
8
+ <li><%%= link_to l(:label_<%= model_name_pluralize_underscored %>), polymorphic_path([@project, :<%= model_name_pluralize_underscored %>], set_filter: '1'), title: l(:label_<%= model_name_pluralize_underscored %>), class: 'icon icon-folder button' %></li>
9
9
  </ul>
@@ -1,8 +1,8 @@
1
- <ul>
2
- <%% if @<%= model_name_underscored %> -%>
3
- <li><%%= context_menu_link l(:button_edit), edit_<%= model_name_underscored %>_path(@<%= model_name_underscored %>), class: 'icon icon-edit', disabled: !@can[:edit] %></li>
4
- <%% end %>
5
- <li><%%= context_menu_link l(:button_delete), <%= model_name_pluralize_underscored %>_path(ids: @<%= model_name_underscored %>_ids, back_url: @back), method: :delete, data: {confirm: l(:text_are_you_sure)}, class: 'icon icon-del', disabled: !@can[:delete] %></li>
6
-
7
- <%%= call_hook(:view_<%= model_name_pluralize_underscored %>_context_menu_end, {<%= model_name_underscored %>: @<%= model_name_underscored %>, <%= model_name_pluralize_underscored %>: @<%= model_name_pluralize_underscored %>, can: @can, back: @back, project: @project}) %>
1
+ <ul>
2
+ <%% if @<%= model_name_underscored %> -%>
3
+ <li><%%= context_menu_link l(:button_edit), edit_<%= model_name_underscored %>_path(@<%= model_name_underscored %>), class: 'icon icon-edit', disabled: !@can[:edit] %></li>
4
+ <%% end %>
5
+ <li><%%= context_menu_link l(:button_delete), <%= model_name_pluralize_underscored %>_path(ids: @<%= model_name_underscored %>_ids, back_url: @back), method: :delete, data: {confirm: l(:text_are_you_sure)}, class: 'icon icon-del', disabled: !@can[:delete] %></li>
6
+
7
+ <%%= call_hook(:view_<%= model_name_pluralize_underscored %>_context_menu_end, {<%= model_name_underscored %>: @<%= model_name_underscored %>, <%= model_name_pluralize_underscored %>: @<%= model_name_pluralize_underscored %>, can: @can, back: @back, project: @project}) %>
8
8
  </ul>
@@ -25,6 +25,7 @@ class <%= controller_class %>Controller < ApplicationController
25
25
  respond_to do |format|
26
26
  format.html
27
27
  format.api
28
+ format.js
28
29
  end
29
30
  end
30
31
 
@@ -1,7 +1,7 @@
1
- class <%= model_name %>CustomField < CustomField
2
-
3
- def type_name
4
- :label_<%= @model_name_pluralize_underscored %>
5
- end
6
-
7
- end
1
+ class <%= model_name %>CustomField < CustomField
2
+
3
+ def type_name
4
+ :label_<%= @model_name_pluralize_underscored %>
5
+ end
6
+
7
+ end
@@ -1,19 +1,19 @@
1
- <%%= title l(:heading_<%= model_name_underscored %>_edit) %>
2
-
3
- <%%= form_for([@project, @<%= model_name_underscored %>], html: {multipart: <%= acts_as_attachable? %>, id: '<%= model_name_underscored %>_form', class: 'tabular', remote: request.xhr?}) do |f| %>
4
- <%%= error_messages_for @<%= model_name_underscored %> %>
5
-
6
- <div class="box">
7
- <%%= render partial: 'form', locals: {<%= model_name_underscored %>: @<%= model_name_underscored %>} %>
8
- </div>
9
-
10
- <%% if !request.xhr? %>
11
- <p>
12
- <%%= submit_tag l(:button_update), title: l(:button_update) %>
13
- </p>
14
- <%% end %>
15
- <%% end %>
16
- <%% ### PAGE CUSTOMS ########################################################## %>
17
- <%% content_for :sidebar do %>
18
- <%%= render :partial => '<%= model_name_pluralize_underscored %>/sidebar' %>
1
+ <%%= title l(:heading_<%= model_name_underscored %>_edit) %>
2
+
3
+ <%%= form_for([@project, @<%= model_name_underscored %>], html: {multipart: <%= acts_as_attachable? %>, id: '<%= model_name_underscored %>_form', class: 'tabular', remote: request.xhr?}) do |f| %>
4
+ <%%= error_messages_for @<%= model_name_underscored %> %>
5
+
6
+ <div class="box">
7
+ <%%= render partial: 'form', locals: {<%= model_name_underscored %>: @<%= model_name_underscored %>} %>
8
+ </div>
9
+
10
+ <%% if !request.xhr? %>
11
+ <p>
12
+ <%%= submit_tag l(:button_update), title: l(:button_update) %>
13
+ </p>
14
+ <%% end %>
15
+ <%% end %>
16
+ <%% ### PAGE CUSTOMS ########################################################## %>
17
+ <%% content_for :sidebar do %>
18
+ <%%= render :partial => '<%= model_name_pluralize_underscored %>/sidebar' %>
19
19
  <%% end %>
@@ -1,17 +1,17 @@
1
- $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/edit', :formats => [:html]) %>");
2
- showModal('ajax-modal', '60%');
3
- var submitButton = {
4
- text:"<%=j l(:button_update) -%>",
5
- title:"<%=j l(:button_update) -%>",
6
- click: function() {$(this).find('form').submit()},
7
- 'class': 'button-positive'
8
- }
9
- var closeButton = {
10
- text: "<%=j l(:button_close) -%>",
11
- title: "<%=j l(:button_close) -%>",
12
- click: function() {$(this).dialog('close');},
13
- 'class': 'button'
14
- }
15
- $("#ajax-modal").dialog('option', {
16
- buttons: [closeButton, submitButton]
1
+ $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/edit', :formats => [:html]) %>");
2
+ showModal('ajax-modal');
3
+ var submitButton = {
4
+ text:"<%=j l(:button_update) -%>",
5
+ title:"<%=j l(:button_update) -%>",
6
+ click: function() {$(this).find('form').submit()},
7
+ 'class': 'button-positive'
8
+ }
9
+ var closeButton = {
10
+ text: "<%=j l(:button_close) -%>",
11
+ title: "<%=j l(:button_close) -%>",
12
+ click: function() {$(this).dialog('close');},
13
+ 'class': 'button'
14
+ }
15
+ $("#ajax-modal").dialog('option', {
16
+ buttons: [closeButton, submitButton]
17
17
  });
@@ -1,5 +1,5 @@
1
- api.array :<%= model_name_pluralize_underscored %>, api_meta(total_count: @entity_count, offset: @offset, limit: @limit) do
2
- @entities.each do |<%= model_name_underscored %>|
3
- render_api_<%= model_name_underscored %>(api, <%= model_name_underscored %>)
4
- end
5
- end
1
+ api.array :<%= model_name_pluralize_underscored %>, api_meta(total_count: @entity_count, offset: @offset, limit: @limit) do
2
+ @entities.each do |<%= model_name_underscored %>|
3
+ render_api_<%= model_name_underscored %>(api, <%= model_name_underscored %>)
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
- <%%= render @query %>
2
- <%% ### PAGE CUSTOMS ########################################################## %>
3
- <%% content_for :sidebar do %>
4
- <%%= render :partial => '<%= model_name_pluralize_underscored %>/sidebar' %>
1
+ <%%= render @query %>
2
+ <%% ### PAGE CUSTOMS ########################################################## %>
3
+ <%% content_for :sidebar do %>
4
+ <%%= render :partial => '<%= model_name_pluralize_underscored %>/sidebar' %>
5
5
  <%% end %>
@@ -0,0 +1,11 @@
1
+ $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/index', :formats => [:html]) %>");
2
+ showModal('ajax-modal');
3
+ var closeButton = {
4
+ text: "<%=j l(:button_close) -%>",
5
+ title: "<%=j l(:button_close) -%>",
6
+ click: function() {$(this).dialog('close');},
7
+ 'class': 'button'
8
+ }
9
+ $("#ajax-modal").dialog('option', {
10
+ buttons: [closeButton, submitButton]
11
+ });
@@ -1 +1 @@
1
- <h1><%%= link_to(@<%= model_name_underscored %>.to_s, @<%= model_name_underscored %>_url) %></h1>
1
+ <h1><%%= link_to(@<%= model_name_underscored %>.to_s, @<%= model_name_underscored %>_url) %></h1>
@@ -1,2 +1,2 @@
1
- <%%= @<%= model_name_underscored %>.to_s %>
2
- <%%= @<%= model_name_underscored %>_url %>
1
+ <%%= @<%= model_name_underscored %>.to_s %>
2
+ <%%= @<%= model_name_underscored %>_url %>
@@ -1,2 +1,2 @@
1
- <%%= @<%= model_name_underscored %>.to_s %>
2
- <%%= @<%= model_name_underscored %>_url %>
1
+ <%%= @<%= model_name_underscored %>.to_s %>
2
+ <%%= @<%= model_name_underscored %>_url %>
@@ -1,9 +1,9 @@
1
- class Create<%= model_name_pluralize_underscored.camelize %> < ActiveRecord::Migration
2
- def change
3
- create_table :<%= model_name_pluralize_underscored %>, force: true do |t|
4
- <%- db_columns.each do |column_name, column_attrs| -%>
5
- t.<%= column_attrs[:type] %> :<%= column_name %>, null: <%= column_attrs[:null] %>
6
- <%- end -%>
7
- end
8
- end
9
- end
1
+ class Create<%= model_name_pluralize_underscored.camelize %> < ActiveRecord::Migration
2
+ def change
3
+ create_table :<%= model_name_pluralize_underscored %>, force: true do |t|
4
+ <%- db_columns.each do |column_name, column_attrs| -%>
5
+ t.<%= column_attrs[:type] %> :<%= column_name %>, null: <%= column_attrs[:null] %>
6
+ <%- end -%>
7
+ end
8
+ end
9
+ end
@@ -1,19 +1,19 @@
1
- <%%= title l(:heading_<%= model_name_underscored %>_new) %>
2
-
3
- <%%= form_for([@project, @<%= model_name_underscored %>], html: {multipart: <%= acts_as_attachable? %>, id: '<%= model_name_underscored %>_form', class: 'tabular', remote: request.xhr?}) do |f| %>
4
- <%%= error_messages_for @<%= model_name_underscored %> %>
5
-
6
- <div class="box">
7
- <%%= render partial: 'form', locals: {<%= model_name_underscored %>: @<%= model_name_underscored %>} %>
8
- </div>
9
-
10
- <%% if !request.xhr? %>
11
- <p>
12
- <%%= submit_tag l(:button_create), title: l(:button_create) %>
13
- </p>
14
- <%% end %>
15
- <%% end %>
16
- <%% ### PAGE CUSTOMS ########################################################## %>
17
- <%% content_for :sidebar do %>
18
- <%%= render :partial => '<%= model_name_pluralize_underscored %>/sidebar' %>
1
+ <%%= title l(:heading_<%= model_name_underscored %>_new) %>
2
+
3
+ <%%= form_for([@project, @<%= model_name_underscored %>], html: {multipart: <%= acts_as_attachable? %>, id: '<%= model_name_underscored %>_form', class: 'tabular', remote: request.xhr?}) do |f| %>
4
+ <%%= error_messages_for @<%= model_name_underscored %> %>
5
+
6
+ <div class="box">
7
+ <%%= render partial: 'form', locals: {<%= model_name_underscored %>: @<%= model_name_underscored %>} %>
8
+ </div>
9
+
10
+ <%% if !request.xhr? %>
11
+ <p>
12
+ <%%= submit_tag l(:button_create), title: l(:button_create) %>
13
+ </p>
14
+ <%% end %>
15
+ <%% end %>
16
+ <%% ### PAGE CUSTOMS ########################################################## %>
17
+ <%% content_for :sidebar do %>
18
+ <%%= render :partial => '<%= model_name_pluralize_underscored %>/sidebar' %>
19
19
  <%% end %>
@@ -1,17 +1,17 @@
1
- $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/new', :formats => [:html]) %>");
2
- showModal('ajax-modal', '60%');
3
- var submitButton = {
4
- text:"<%=j l(:button_create) -%>",
5
- title:"<%=j l(:button_create) -%>",
6
- click: function() {$(this).find('form').submit()},
7
- 'class': 'button-positive'
8
- }
9
- var closeButton = {
10
- text: "<%=j l(:button_close) -%>",
11
- title: "<%=j l(:button_close) -%>",
12
- click: function() {$(this).dialog('close');},
13
- 'class': 'button'
14
- }
15
- $("#ajax-modal").dialog('option', {
16
- buttons: [closeButton, submitButton]
1
+ $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/new', :formats => [:html]) %>");
2
+ showModal('ajax-modal');
3
+ var submitButton = {
4
+ text:"<%=j l(:button_create) -%>",
5
+ title:"<%=j l(:button_create) -%>",
6
+ click: function() {$(this).find('form').submit()},
7
+ 'class': 'button-positive'
8
+ }
9
+ var closeButton = {
10
+ text: "<%=j l(:button_close) -%>",
11
+ title: "<%=j l(:button_close) -%>",
12
+ click: function() {$(this).dialog('close');},
13
+ 'class': 'button'
14
+ }
15
+ $("#ajax-modal").dialog('option', {
16
+ buttons: [closeButton, submitButton]
17
17
  });