activeadmin-selleo-cms 0.0.51 → 0.0.52

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.
@@ -117,7 +117,6 @@ ActiveAdmin.register ActiveadminSelleoCms::Page, as: "Page", sort_order: "lft_as
117
117
  li t("active_admin.cms.no_sections_defined")
118
118
  end
119
119
  end
120
- button_to_function(t("active_admin.cms.save_changes"), "savePage()")
121
120
  end
122
121
 
123
122
  end
@@ -29,7 +29,14 @@ ActiveAdmin.register Translation do
29
29
 
30
30
  controller do
31
31
  def collection
32
- (get_collection_ivar || set_collection_ivar(active_admin_collection)).reorder(:key).select("DISTINCT(key)")
32
+ _collection = get_collection_ivar
33
+
34
+ return _collection if _collection
35
+
36
+ _collection = find_collection.reorder(:key).select("DISTINCT(key)")
37
+ authorize! ActiveAdmin::Authorization::READ, active_admin_config.resource_class
38
+
39
+ set_collection_ivar _collection
33
40
  end
34
41
  end
35
42
  end
Binary file
Binary file
@@ -99,7 +99,7 @@ function update_positions(pagesArray) {
99
99
  }
100
100
 
101
101
  $(function(){
102
- $('#translations.index input').blur(function(evt){
102
+ $('#index_table_translations.index input').blur(function(evt){
103
103
  $.ajax({
104
104
  url: $(evt.target).data('route') + '.js',
105
105
  type: 'PUT',
@@ -5,11 +5,12 @@ CKEDITOR.dialog.add( 'formswidgetDialog', function ( editor ) {
5
5
  type: 'GET',
6
6
  async: false,
7
7
  success: function(resp){
8
- items = [$.map(resp, function(obj, idx) {
9
- return [obj.title, obj.id]
10
- })]
8
+ items = $.map(resp, function(obj, idx) {
9
+ return [[obj.title, obj.id]]
10
+ })
11
11
  }
12
12
  });
13
+ debugger;
13
14
 
14
15
  return {
15
16
  title: 'Insert form',
@@ -4,8 +4,9 @@ module ActiveadminSelleoCms
4
4
  TYPE_TEXT = 0
5
5
  TYPE_SELECT = 1
6
6
  TYPE_FILE = 2
7
- TYPES = [TYPE_TEXT, TYPE_SELECT, TYPE_FILE]
8
- TYPE_NAMES = ["text question", "select question", "file upload"]
7
+ TYPE_LABEL = 3
8
+ TYPES = [TYPE_TEXT, TYPE_SELECT, TYPE_FILE, TYPE_LABEL]
9
+ TYPE_NAMES = ["text question", "select question", "file upload", "label"]
9
10
 
10
11
  belongs_to :form
11
12
  has_many :options, class_name: "FormQuestionOption", :order => "position"
@@ -25,7 +26,7 @@ module ActiveadminSelleoCms
25
26
  end
26
27
 
27
28
  def question_type_dictionary(int)
28
- ["text question", "select question", "file upload"][int]
29
+ ["text question", "select question", "file upload", "label"][int]
29
30
  end
30
31
 
31
32
  end
@@ -57,6 +58,8 @@ module ActiveadminSelleoCms
57
58
  :radio_button_tag
58
59
  elsif question_type == TYPE_FILE
59
60
  :file_field_tag
61
+ elsif question_type == TYPE_LABEL
62
+ :legend
60
63
  end
61
64
  end
62
65
 
@@ -70,6 +73,10 @@ module ActiveadminSelleoCms
70
73
  end
71
74
  end
72
75
 
76
+ def label
77
+ "#{title}#{'<i>'+I18n.t("active_admin.cms.forms.required")+'</i>' if is_required}".html_safe
78
+ end
79
+
73
80
  end
74
81
 
75
82
  end
@@ -18,5 +18,9 @@ module ActiveadminSelleoCms
18
18
  end
19
19
  end
20
20
 
21
+ def label
22
+ title
23
+ end
24
+
21
25
  end
22
26
  end
@@ -1,14 +1,15 @@
1
1
  = semantic_nested_form_for [:admin, @form, @form_question], url: (@form_question.new_record? ? admin_form_form_questions_path(@form.id) : admin_form_form_question_path(@form.id, @form_question.id)), remote: true, html: {id: "form_question_form"} do |form|
2
2
  = form.inputs "Options" do
3
3
  = form.input :title
4
- = form.input :hint
5
- = form.input :is_required
6
- - unless @form_question.is_type?('file')
7
- = form.input :is_multi
8
4
  = form.input :question_type, as: :hidden
9
- - if @form_question.is_type?('select')
10
- = form.input :has_other_option
11
- = form.input :order, as: :hidden
5
+ - unless @form_question.is_type?('label')
6
+ = form.input :hint
7
+ = form.input :is_required
8
+ - unless @form_question.is_type?('file')
9
+ = form.input :is_multi
10
+ - if @form_question.is_type?('select')
11
+ = form.input :has_other_option
12
+ = form.input :order, as: :hidden
12
13
 
13
14
  - if @form_question.is_type?('select')
14
15
  = form.inputs "Add options" do
@@ -24,7 +24,7 @@
24
24
  },
25
25
 
26
26
  receive:function (event, ui) {
27
- $('#question_container').load("#{new_admin_form_form_question_url(@form)}?question_type="+$(ui.helper).attr("data-qtype")).dialog({modal:true, closeOnEscape: false});
27
+ $('#question_container').load("#{new_admin_form_form_question_url(@form)}?question_type="+$(ui.helper).attr("data-qtype")).dialog({modal:true, closeOnEscape: false, width: 800});
28
28
  }
29
29
  }).disableSelection();
30
30
 
@@ -46,5 +46,5 @@
46
46
  }
47
47
 
48
48
  function editQuestion(id){
49
- $('#question_container').load("/admin/forms/#{@form.id}/form_questions/" + id + "/edit").dialog({modal:true, closeOnEscape: false});
49
+ $('#question_container').load("/admin/forms/#{@form.id}/form_questions/" + id + "/edit").dialog({modal:true, closeOnEscape: false, width: 800});
50
50
  }
@@ -1,4 +1,4 @@
1
1
  - if @translation and @translation.update_attribute(:value, params[:value])
2
- $('#translations.index input[data-locale="#{@translation.locale}"]').filter('[data-key="#{@translation.key}"]').closest('td').effect('highlight');
2
+ $('#index_table_translations.index input[data-locale="#{@translation.locale}"]').filter('[data-key="#{@translation.key}"]').closest('td').effect('highlight');
3
3
  - else
4
4
  alert('#{t("cms.errors.ajax.update.unknown_error")}');
@@ -1,18 +1,24 @@
1
+ <%= button_to_function t("active_admin.cms.forms.submit"), "deliver(#{form.id}, '#{dom_id(form)}')", class: 'send' %>
2
+
1
3
  <%= form_tag '/forms', multipart: true, id: dom_id(form), data: {form_id: form.id} do %>
2
4
  <ol class="questions">
3
5
  <% form.questions.each do |question| %>
4
6
  <li class="question <%= question.input_type %>">
5
- <div class="questions_labels">
6
- <%= label_tag dom_id(question), question.title %>
7
- <% if question.hint.present? %>
8
- <p class="hint"><%= question.hint %></p>
9
- <% end %>
10
- </div>
7
+
8
+ <% unless question.input_type == :legend %>
9
+ <div class="questions_labels">
10
+ <%= label_tag dom_id(question), question.label %>
11
+ <% if question.hint.present? %>
12
+ <p class="hint"><%= question.hint %></p>
13
+ <% end %>
14
+ </div>
15
+ <% end %>
16
+
11
17
  <% if [:check_box_tag].include? question.input_type %>
12
18
  <div class="questions_options">
13
19
  <% question.options.each do |option| %>
14
20
  <%= send(question.input_type, "#{dom_id(question)}[]", option.id, false, required: question.is_required, id: dom_id(option), data: {form_question_id: question.id} ) %>
15
- <%= label_tag dom_id(option), option.title %>
21
+ <%= label_tag dom_id(option), option.label %>
16
22
  <% end %>
17
23
  <%= text_field_tag "#{dom_id(question)}_other", "", data: {form_question_id: question.id} if question.has_other_option %>
18
24
  </div>
@@ -20,12 +26,18 @@
20
26
  <div class="questions_options">
21
27
  <% question.options.each do |option| %>
22
28
  <%= send(question.input_type, dom_id(question), option.id, false, required: question.is_required, id: dom_id(option), data: {form_question_id: question.id}) %>
23
- <%= label_tag dom_id(option), option.title %>
29
+ <%= label_tag dom_id(option), option.label %>
24
30
  <% end %>
31
+ <%= label_tag "#{dom_id(question)}_other", t("active_admin.cms.forms.other") %>
25
32
  <%= text_field_tag "#{dom_id(question)}_other", "", data: {form_question_id: question.id} if question.has_other_option %>
26
33
  </div>
27
34
  <% elsif [:file_field_tag].include? question.input_type %>
28
- <%= button_to_function "Select file", "fileUpload('#{dom_id(form)}', '#{dom_id(question)}', #{question.id})", style: "padding: 5px;" %>
35
+ <div class="file_upload" data-question-id="<%= question.id %>">
36
+ <p></p>
37
+ <%= button_to_function t("active_admin.cms.forms.select_file"), "fileUpload('#{dom_id(form)}', '#{dom_id(question)}', #{question.id})", style: "padding: 5px;" %>
38
+ </div>
39
+ <% elsif question.input_type == :legend %>
40
+ <legend><%= question.label %></legend>
29
41
  <% else %>
30
42
  <%= send(question.input_type, dom_id(question), "", required: question.is_required, data: {form_question_id: question.id}) %>
31
43
  <% end %>
@@ -34,9 +46,9 @@
34
46
  </ol>
35
47
  <% end %>
36
48
 
37
- <%= button_to_function "Print", "print(#{form.id}, '#{dom_id(form)}')", class: 'print', title: 'Print' %>
38
- <%= button_to_function "Download PDF", "downloadPDF(#{form.id}, '#{dom_id(form)}')", class: 'save', title: 'Download PDF' %>
39
- <%= button_to_function "Send to JIPS", "deliver(#{form.id}, '#{dom_id(form)}')", class: 'send' %>
49
+ <%= button_to_function "", "print(#{form.id}, '#{dom_id(form)}')", class: 'print', title: t("active_admin.cms.forms.print") %>
50
+ <%= button_to_function "", "downloadPDF(#{form.id}, '#{dom_id(form)}')", class: 'save', title: t("active_admin.cms.forms.pdf") %>
51
+ <%= button_to_function t("active_admin.cms.forms.submit"), "deliver(#{form.id}, '#{dom_id(form)}')", class: 'send' %>
40
52
 
41
53
  <script>
42
54
  $(function(){
@@ -34,4 +34,11 @@ en:
34
34
  edit_image: "Edit image"
35
35
  edit_related_item: "Edit related"
36
36
  hint: "Hint: drag and drop files to reorder them"
37
- no_cover: "No cover image"
37
+ no_cover: "No cover image"
38
+ forms:
39
+ submit: "Submit form"
40
+ print: "Print"
41
+ pdf: "Download PDF"
42
+ select_file: "Select file"
43
+ other: "Other"
44
+ required: "&nbsp;(required)"
@@ -1,3 +1,3 @@
1
1
  module ActiveadminSelleoCms
2
- VERSION = "0.0.51"
2
+ VERSION = "0.0.52"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-selleo-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.51
4
+ version: 0.0.52
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-16 00:00:00.000000000 Z
12
+ date: 2013-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -441,6 +441,12 @@ files:
441
441
  - app/assets/stylesheets/active_admin/jquery-ui.css.scss
442
442
  - app/assets/stylesheets/active_admin/cms.css.scss
443
443
  - app/assets/stylesheets/active_admin/jquery.Jcrop.css
444
+ - app/assets/images/admin/question_2.png
445
+ - app/assets/images/admin/edit.png
446
+ - app/assets/images/admin/question_0.png
447
+ - app/assets/images/admin/remove.png
448
+ - app/assets/images/admin/question_3.png
449
+ - app/assets/images/admin/question_1.png
444
450
  - app/assets/images/activeadmin-selleo-cms/Jcrop.gif
445
451
  - app/assets/javascripts/active_admin.js
446
452
  - app/assets/javascripts/ckeditor/config.js