refinerycms-multiform 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/multiforms_controller.rb +10 -0
- data/app/controllers/admin/submissions_controller.rb +10 -0
- data/app/controllers/multiforms_controller.rb +30 -0
- data/app/controllers/submissions_controller.rb +16 -0
- data/app/models/multiform.rb +20 -0
- data/app/models/multiform_submission.rb +49 -0
- data/app/views/admin/multiforms/_form.html.erb +37 -0
- data/app/views/admin/multiforms/_multiform.html.erb +19 -0
- data/app/views/admin/multiforms/_sortable_list.html.erb +4 -0
- data/app/views/admin/multiforms/edit.html.erb +1 -0
- data/app/views/admin/multiforms/index.html.erb +65 -0
- data/app/views/admin/multiforms/new.html.erb +1 -0
- data/app/views/admin/multiforms/show.html.erb +28 -0
- data/app/views/admin/submissions/_multiform_submission.html.erb +18 -0
- data/app/views/admin/submissions/index.html.erb +52 -0
- data/app/views/admin/submissions/index_tmp.html.erb +43 -0
- data/app/views/admin/submissions/show.html.erb +25 -0
- data/app/views/multiforms/index.html.erb +11 -0
- data/app/views/multiforms/show.html.erb +30 -0
- data/config/locales/en.yml +61 -0
- data/config/locales/nb.yml +19 -0
- data/config/locales/nl.yml +19 -0
- data/config/routes.rb +16 -0
- data/db/migrate/create_multiforms.rb +39 -0
- data/db/seeds/multiforms.rb +5 -0
- data/lib/generators/refinerycms_multiforms_generator.rb +6 -0
- data/lib/refinerycms_multiforms.rb +39 -0
- data/lib/tasks/multiforms.rake +13 -0
- data/readme.md +10 -0
- metadata +93 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
class MultiformsController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :find_all_multiforms
|
4
|
+
before_filter :find_page
|
5
|
+
|
6
|
+
def index
|
7
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
8
|
+
# by swapping @page for @multiform in the line below:
|
9
|
+
present(@page)
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
@multiform = Multiform.find(params[:id])
|
14
|
+
|
15
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
16
|
+
# by swapping @page for @multiform in the line below:
|
17
|
+
present(@page)
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def find_all_multiforms
|
23
|
+
@multiforms = Multiform.find(:all, :order => "position ASC")
|
24
|
+
end
|
25
|
+
|
26
|
+
def find_page
|
27
|
+
@page = Page.find_by_link_url("/multiforms")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class SubmissionsController < ApplicationController
|
2
|
+
skip_before_filter :verify_authenticity_token, :only => :create
|
3
|
+
before_filter :find_multiform, :only => :create
|
4
|
+
|
5
|
+
def create
|
6
|
+
@submission = MultiformSubmission.new(:multiform_id => @multiform)
|
7
|
+
@submission.raw = params.to_yaml
|
8
|
+
@submission.save
|
9
|
+
redirect_to @multiform.page.url
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
def find_multiform
|
14
|
+
@multiform = Multiform.find(params[:multiform_id])
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Multiform < ActiveRecord::Base
|
2
|
+
acts_as_indexed :fields => [:title]
|
3
|
+
|
4
|
+
validates_presence_of :title
|
5
|
+
validates_uniqueness_of :title
|
6
|
+
|
7
|
+
has_many :multiform_submissions
|
8
|
+
# has_many :multiform_email_actions
|
9
|
+
belongs_to :page
|
10
|
+
|
11
|
+
attr_accessor :parsed_fields
|
12
|
+
|
13
|
+
def parsed_fields
|
14
|
+
res = []
|
15
|
+
res << "##created_at##"
|
16
|
+
# TODO: generate fields from submissions
|
17
|
+
return res
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class MultiformSubmission < ActiveRecord::Base
|
2
|
+
acts_as_indexed :fields => [:created_at]
|
3
|
+
validates_presence_of :raw
|
4
|
+
|
5
|
+
belongs_to :multiform
|
6
|
+
after_create :do_actions
|
7
|
+
|
8
|
+
@@plugins = []
|
9
|
+
|
10
|
+
# Plugins will be called as follows:
|
11
|
+
# Clazz.on_submission(submission)
|
12
|
+
def self.register_plugin(clazz)
|
13
|
+
@@plugins.push(clazz)
|
14
|
+
@@plugins.uniq!
|
15
|
+
puts "Registered Multiform Submission Plugin: #{clazz}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def title
|
19
|
+
"#{created_at.strftime('%D %H:%M%P')} - #{multiform.title}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def apply_template(html = false)
|
23
|
+
s = YAML.load raw
|
24
|
+
res = multiform.report_template
|
25
|
+
res.gsub!(/##created_at##/,self.created_at.to_s)
|
26
|
+
res.scan(/##([^#]+)##/).each do |md|
|
27
|
+
begin
|
28
|
+
res.gsub!(/\#\##{md[0]}\#\#/,s[md[0]])
|
29
|
+
rescue
|
30
|
+
end
|
31
|
+
end
|
32
|
+
if html
|
33
|
+
res.gsub!(/\n/,"<br />")
|
34
|
+
end
|
35
|
+
return res
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.plugins
|
39
|
+
@@plugins
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def do_actions
|
44
|
+
@@plugins.each do |plugin|
|
45
|
+
plugin.on_submission(self) rescue nil
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% form_for [:admin, @multiform] do |f| -%>
|
2
|
+
<%= render :partial => "/shared/admin/error_messages", :locals => {
|
3
|
+
:object => @multiform,
|
4
|
+
:include_object_name => true
|
5
|
+
} %>
|
6
|
+
|
7
|
+
<div class='field'>
|
8
|
+
<%= f.label :title -%>
|
9
|
+
<%= f.text_field :title, :class => 'larger widest' -%>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class='field'>
|
13
|
+
<%= f.label :page_id, 'Redirect Page' %>
|
14
|
+
<%= f.select :page_id, Page.find(:all).collect{|p| [p.title,p.id]} %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<% if !@multiform.new_record? -%>
|
18
|
+
<h2>Report Template Fields:</h2>
|
19
|
+
<ul style="display:inline;list-style-type:none;margin:10px 0;padding-left: 0;font-weight:bold;">
|
20
|
+
<% @multiform.parsed_fields.each do |pf| -%>
|
21
|
+
<li><%= pf %></li>
|
22
|
+
<% end -%>
|
23
|
+
</ul>
|
24
|
+
<br style="clear:both;" />
|
25
|
+
<div class='field'>
|
26
|
+
<%= f.label :report_template -%>
|
27
|
+
<%= f.text_area :report_template, :rows => 20, :class => 'widest' -%>
|
28
|
+
</div>
|
29
|
+
<% end -%>
|
30
|
+
<%= render :partial => "/shared/admin/form_actions",
|
31
|
+
:locals => {
|
32
|
+
:f => f,
|
33
|
+
:continue_editing => false,
|
34
|
+
:delete_title => t('admin.multiforms.multiform.delete'),
|
35
|
+
:delete_confirmation => t('shared.admin.delete.message', :title => @multiform.title)
|
36
|
+
} %>
|
37
|
+
<% end -%>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(multiform) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= multiform.title %>
|
4
|
+
<span class="preview"> </span>
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
<%= link_to refinery_icon_tag("application_go.png"), admin_multiform_url(multiform),
|
8
|
+
:title => t('.view_details') %>
|
9
|
+
<%= link_to refinery_icon_tag("application_edit.png"), edit_admin_multiform_path(multiform),
|
10
|
+
:title => t('.edit') %>
|
11
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_multiform_path(multiform),
|
12
|
+
:class => "cancel confirm-delete",
|
13
|
+
:title => t('.delete'),
|
14
|
+
:'data-confirm' => t('shared.admin.delete.message',
|
15
|
+
:title => multiform.title
|
16
|
+
),
|
17
|
+
:'data-method' => :delete %>
|
18
|
+
</span>
|
19
|
+
</li>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<ul>
|
3
|
+
<li>
|
4
|
+
<%= render :partial => "/shared/admin/search",
|
5
|
+
:locals => {
|
6
|
+
:url => admin_multiforms_url
|
7
|
+
} %>
|
8
|
+
</li>
|
9
|
+
<li>
|
10
|
+
<%= link_to t('.create_new'), new_admin_multiform_url,
|
11
|
+
:class => "add_icon" %>
|
12
|
+
</li>
|
13
|
+
<% if !searching? and Multiform.count > 1 %>
|
14
|
+
<li>
|
15
|
+
<%= link_to t('refinery.reorder', :what => "Multiforms"),
|
16
|
+
admin_multiforms_url,
|
17
|
+
:id => "reorder_action",
|
18
|
+
:class => "reorder_icon" %>
|
19
|
+
|
20
|
+
<%= link_to t('refinery.reorder_done', :what => "Multiforms"),
|
21
|
+
admin_multiforms_url,
|
22
|
+
:id => "reorder_action_done",
|
23
|
+
:style => "display: none;",
|
24
|
+
:class => "reorder_icon" %>
|
25
|
+
</li>
|
26
|
+
<% end %>
|
27
|
+
</ul>
|
28
|
+
</div>
|
29
|
+
<div id='records'>
|
30
|
+
<% if searching? %>
|
31
|
+
<h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
|
32
|
+
<% if @multiforms.any? %>
|
33
|
+
<%= will_paginate @multiforms, :previous_label => '«', :next_label => '»' %>
|
34
|
+
<ul>
|
35
|
+
<%= render :partial => "multiform",
|
36
|
+
:collection => @multiforms %>
|
37
|
+
</ul>
|
38
|
+
<%= will_paginate @multiforms, :previous_label => '«', :next_label => '»' %>
|
39
|
+
<% else %>
|
40
|
+
<p><%= t('shared.admin.search.no_results') %></p>
|
41
|
+
<% end %>
|
42
|
+
<% else %>
|
43
|
+
<% if @multiforms.any? %>
|
44
|
+
<%= will_paginate @multiforms,
|
45
|
+
:previous_label => '«',
|
46
|
+
:next_label => '»' %>
|
47
|
+
|
48
|
+
<%= render :partial => "sortable_list" %>
|
49
|
+
|
50
|
+
<%= will_paginate @multiforms,
|
51
|
+
:previous_label => '«',
|
52
|
+
:next_label => '»' %>
|
53
|
+
<% else %>
|
54
|
+
<p>
|
55
|
+
<strong>
|
56
|
+
<%= t('.no_items_yet') %>
|
57
|
+
</strong>
|
58
|
+
</p>
|
59
|
+
<% end %>
|
60
|
+
<% end %>
|
61
|
+
</div>
|
62
|
+
<%= render :partial => "/shared/admin/make_sortable",
|
63
|
+
:locals => {
|
64
|
+
:tree => false
|
65
|
+
} if !searching? and Multiform.count > 1 %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<h2><%= t('.details') %></h2>
|
3
|
+
<p>
|
4
|
+
<strong><%= t('.age') %>:</strong> <%= time_ago_in_words(@multiform.created_at) %>
|
5
|
+
</p>
|
6
|
+
<p>
|
7
|
+
<strong><%= t('.submission_count') %>:</strong> <%= @multiform.multiform_submissions.count %>
|
8
|
+
</p>
|
9
|
+
<ul>
|
10
|
+
<% MultiformSubmission.plugins.each do |plugin| -%>
|
11
|
+
<li><%= raw(plugin.render_add_new_action_link(binding)) %></li>
|
12
|
+
<% end -%>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<div id='records'>
|
16
|
+
<h2><%= @multiform.title %></h2>
|
17
|
+
<strong>Report Template:</strong><br />
|
18
|
+
<pre><code>
|
19
|
+
<%= @multiform.report_template %>
|
20
|
+
</pre></code>
|
21
|
+
<br />
|
22
|
+
<strong>Actions</strong><br />
|
23
|
+
<ul>
|
24
|
+
<% MultiformSubmission.plugins.each do |plugin| -%>
|
25
|
+
<%= raw(plugin.render_action_rows(binding)) %>
|
26
|
+
<% end -%>
|
27
|
+
</ul>
|
28
|
+
</div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(multiform_submission) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= multiform_submission.title %>
|
4
|
+
<span class="preview"> </span>
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
<%= link_to refinery_icon_tag("application_go.png"), admin_submission_url(multiform_submission),
|
8
|
+
:title => t('.view_live'),
|
9
|
+
:target => "_blank" %>
|
10
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_submission_path(multiform_submission),
|
11
|
+
:class => "cancel confirm-delete",
|
12
|
+
:title => t('.delete'),
|
13
|
+
:'data-confirm' => t('shared.admin.delete.message',
|
14
|
+
:title => multiform_submission.title
|
15
|
+
),
|
16
|
+
:'data-method' => :delete %>
|
17
|
+
</span>
|
18
|
+
</li>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<ul>
|
3
|
+
<li>
|
4
|
+
<%= render :partial => "/shared/admin/search",
|
5
|
+
:locals => {
|
6
|
+
:url => admin_submissions_url
|
7
|
+
} %>
|
8
|
+
</li>
|
9
|
+
</ul>
|
10
|
+
</div>
|
11
|
+
<div id='records'>
|
12
|
+
<% if searching? -%>
|
13
|
+
<h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
|
14
|
+
<% if @multiform_submissions.any? -%>
|
15
|
+
<%= will_paginate @multiform_submissions,
|
16
|
+
:previous_label => '«',
|
17
|
+
:next_label => '»' %>
|
18
|
+
|
19
|
+
<ul>
|
20
|
+
<%= render :partial => "multiform_submission",
|
21
|
+
:collection => @multiform_submissions %>
|
22
|
+
</ul>
|
23
|
+
<%= will_paginate @multiform_submissions,
|
24
|
+
:previous_label => '«',
|
25
|
+
:next_label => '»' %>
|
26
|
+
|
27
|
+
<% else -%>
|
28
|
+
<p><%= t('shared.admin.search.no_results') %></p>
|
29
|
+
<% end -%>
|
30
|
+
<% else -%>
|
31
|
+
<% if @multiform_submissions.any? -%>
|
32
|
+
<%= will_paginate @multiform_submissions,
|
33
|
+
:previous_label => '«',
|
34
|
+
:next_label => '»' %>
|
35
|
+
|
36
|
+
<ul>
|
37
|
+
<%= render :partial => "multiform_submission",
|
38
|
+
:collection => @multiform_submissions %>
|
39
|
+
</ul>
|
40
|
+
<%= will_paginate @multiform_submissions,
|
41
|
+
:previous_label => '«',
|
42
|
+
:next_label => '»' %>
|
43
|
+
|
44
|
+
<% else -%>
|
45
|
+
<p>
|
46
|
+
<strong>
|
47
|
+
<%= t('.no_items_yet') %>
|
48
|
+
</strong>
|
49
|
+
</p>
|
50
|
+
<% end -%>
|
51
|
+
<% end -%>
|
52
|
+
</div>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<ul>
|
3
|
+
<li>
|
4
|
+
<%= render :partial => "/shared/admin/search",
|
5
|
+
:locals => {
|
6
|
+
:url => admin_submissions_url
|
7
|
+
} %>
|
8
|
+
</li>
|
9
|
+
</ul>
|
10
|
+
</div>
|
11
|
+
<div id='records'>
|
12
|
+
<% if searching? %>
|
13
|
+
<h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
|
14
|
+
<% if @multiform_submissions.any? %>
|
15
|
+
<%= will_paginate @multiform_submissions, :previous_label => '«', :next_label => '»' %>
|
16
|
+
<ul>
|
17
|
+
<%= render :partial => "multiform_submission",
|
18
|
+
:collection => @multiform_submissions %>
|
19
|
+
</ul>
|
20
|
+
<%= will_paginate @multiform_submissions, :previous_label => '«', :next_label => '»' %>
|
21
|
+
<% else %>
|
22
|
+
<p><%= t('shared.admin.search.no_results') %></p>
|
23
|
+
<% end %>
|
24
|
+
<% else %>
|
25
|
+
<% if @multiform_submissions.any? %>
|
26
|
+
<%= will_paginate @multiform_submissions,
|
27
|
+
:previous_label => '«',
|
28
|
+
:next_label => '»' %>
|
29
|
+
|
30
|
+
<%= render :partial => "sortable_list" %>
|
31
|
+
|
32
|
+
<%= will_paginate @multiform_submissions,
|
33
|
+
:previous_label => '«',
|
34
|
+
:next_label => '»' %>
|
35
|
+
<% else %>
|
36
|
+
<p>
|
37
|
+
<strong>
|
38
|
+
<%= t('.no_items_yet') %>
|
39
|
+
</strong>
|
40
|
+
</p>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<h2><%= t('.details')%></h2>
|
3
|
+
<p>
|
4
|
+
<strong><%= t('.age') %>:</strong> <%= time_ago_in_words(@multiform_submission.created_at) %>
|
5
|
+
</p>
|
6
|
+
<h2><%= t('.actions') %></h2>
|
7
|
+
<ul>
|
8
|
+
<li>
|
9
|
+
<%= link_to t('.back_to_all_submissions'), {:action => 'index'}, :class => "back_icon" %>
|
10
|
+
</li>
|
11
|
+
<li>
|
12
|
+
<%= link_to t('admin.submissions.delete'),
|
13
|
+
admin_submission_url(@multiform_submission),
|
14
|
+
:class => 'delete_icon no-tooltip confirm-delete',
|
15
|
+
:title => t('admin.inquiries.delete'),
|
16
|
+
:'data-confirm' => t('shared.admin.delete.message', :title => @multiform_submission.title),
|
17
|
+
:'data-method' => "delete" %>
|
18
|
+
</li>
|
19
|
+
</ul>
|
20
|
+
</div>
|
21
|
+
<div id='records'>
|
22
|
+
<pre><code>
|
23
|
+
<%= @multiform_submission.apply_template %>
|
24
|
+
</code></pre>
|
25
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% content_for :body_content_left do %>
|
2
|
+
<ul id="multiforms">
|
3
|
+
<% @multiforms.each do |multiform| %>
|
4
|
+
<li>
|
5
|
+
<%= link_to multiform.title, multiform_url(multiform) %>
|
6
|
+
</li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<% content_for :body_content_title do %>
|
2
|
+
<%= @multiform.title %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :body_content_left do %>
|
6
|
+
|
7
|
+
<div>
|
8
|
+
<h3>Title</h3>
|
9
|
+
<%=raw @multiform.title %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div>
|
13
|
+
<h3>Notification Template</h3>
|
14
|
+
<%=raw @multiform.notification_template %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<% content_for :body_content_right do %>
|
20
|
+
<h2><%= t('.other') %></h2>
|
21
|
+
<ul id="multiforms">
|
22
|
+
<% @multiforms.each do |multiform| %>
|
23
|
+
<li>
|
24
|
+
<%= link_to multiform.title, multiform_url(multiform) %>
|
25
|
+
</li>
|
26
|
+
<% end %>
|
27
|
+
</ul>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
en:
|
2
|
+
shared:
|
3
|
+
admin:
|
4
|
+
image_picker:
|
5
|
+
image: image
|
6
|
+
plugins:
|
7
|
+
refinerycms_multiforms:
|
8
|
+
title: Multiforms
|
9
|
+
refinerycms_multiforms_view:
|
10
|
+
title: Submissions
|
11
|
+
admin:
|
12
|
+
multiforms:
|
13
|
+
index:
|
14
|
+
create_new: Create a new Multiform
|
15
|
+
reorder: Reorder Multiforms
|
16
|
+
reorder_done: Done Reordering Multiforms
|
17
|
+
sorry_no_results: Sorry! There are no results found.
|
18
|
+
no_items_yet: There are no Multiforms yet. Click "Create a new Multiform" to add your first multiform.
|
19
|
+
show:
|
20
|
+
details: Details
|
21
|
+
age: Created
|
22
|
+
submission_count: Submissions Received
|
23
|
+
create_new_email_action: Add new email action
|
24
|
+
multiform:
|
25
|
+
view_live: View this multiform live <br/><em>(opens in a new window)</em>
|
26
|
+
view_details: View details for this multiform <br /><em>(Add and remove form actions)</em>
|
27
|
+
edit: Edit this multiform
|
28
|
+
delete: Remove this multiform forever
|
29
|
+
submissions:
|
30
|
+
delete: Remove this submission forever
|
31
|
+
submission:
|
32
|
+
read_submission: Read the submission
|
33
|
+
said: said
|
34
|
+
mark_as_spam: Mark as spam
|
35
|
+
mark_as_ham: Move to inbox
|
36
|
+
submenu:
|
37
|
+
inbox: Inbox
|
38
|
+
spam: Spam
|
39
|
+
update_notified: Update who gets notified
|
40
|
+
edit_confirmation_email: Edit confirmation email
|
41
|
+
index:
|
42
|
+
no_submissions: You have not received any submissions yet.
|
43
|
+
spam:
|
44
|
+
no_spam: Hooray! You don't have any spam.
|
45
|
+
show:
|
46
|
+
details: Details
|
47
|
+
age: Age
|
48
|
+
actions: Actions
|
49
|
+
back_to_all_submissions: Back to all Submissions
|
50
|
+
spam: Spam
|
51
|
+
spam_yes: 'yes'
|
52
|
+
submission: Submission
|
53
|
+
to: To
|
54
|
+
from: From
|
55
|
+
click_to_email: Click to email this address
|
56
|
+
phone: Phone
|
57
|
+
date: Date
|
58
|
+
message: Message
|
59
|
+
multiforms:
|
60
|
+
show:
|
61
|
+
other: Other Multiforms
|
@@ -0,0 +1,19 @@
|
|
1
|
+
nb:
|
2
|
+
plugins:
|
3
|
+
multiforms:
|
4
|
+
title: Multiforms
|
5
|
+
admin:
|
6
|
+
multiforms:
|
7
|
+
index:
|
8
|
+
create_new: Lag en ny Multiform
|
9
|
+
reorder: Endre rekkefølgen på Multiforms
|
10
|
+
reorder_done: Ferdig å endre rekkefølgen Multiforms
|
11
|
+
sorry_no_results: Beklager! Vi fant ikke noen resultater.
|
12
|
+
no_items_yet: Det er ingen Multiforms enda. Klikk på "Lag en ny Multiform" for å legge til din første multiform.
|
13
|
+
multiform:
|
14
|
+
view_live: Vis hvordan denne multiform ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
|
15
|
+
edit: Rediger denne multiform
|
16
|
+
delete: Fjern denne multiform permanent
|
17
|
+
multiforms:
|
18
|
+
show:
|
19
|
+
other: Andre Multiforms
|
@@ -0,0 +1,19 @@
|
|
1
|
+
nl:
|
2
|
+
plugins:
|
3
|
+
multiforms:
|
4
|
+
title: Multiforms
|
5
|
+
admin:
|
6
|
+
multiforms:
|
7
|
+
index:
|
8
|
+
create_new: Maak een nieuwe Multiform
|
9
|
+
reorder: Wijzig de volgorde van de Multiforms
|
10
|
+
reorder_done: Klaar met het wijzingen van de volgorde van de Multiforms
|
11
|
+
sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
|
12
|
+
no_items_yet: Er zijn nog geen Multiforms. Druk op 'Maak een nieuwe Multiform' om de eerste aan te maken.
|
13
|
+
multiform:
|
14
|
+
view_live: Bekijk deze multiform op de website <br/><em>(opent een nieuw venster)</em>
|
15
|
+
edit: Bewerk deze multiform
|
16
|
+
delete: Verwijder deze multiform voor eeuwig
|
17
|
+
multiforms:
|
18
|
+
show:
|
19
|
+
other: Andere Multiforms
|
data/config/routes.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Refinery::Application.routes.draw do
|
2
|
+
resources :multiforms do
|
3
|
+
resources :submissions
|
4
|
+
end
|
5
|
+
|
6
|
+
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
7
|
+
resources :multiforms do
|
8
|
+
collection do
|
9
|
+
post :update_positions
|
10
|
+
end
|
11
|
+
resources :email_actions
|
12
|
+
end
|
13
|
+
resources :submissions
|
14
|
+
resources :email_actions
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class CreateMultiforms < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :multiforms do |t|
|
5
|
+
t.string :title
|
6
|
+
t.integer :page_id
|
7
|
+
t.text :report_template
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
add_index :multiforms, :id
|
11
|
+
|
12
|
+
create_table :multiform_submissions do |t|
|
13
|
+
t.integer :multiform_id
|
14
|
+
t.string :ip
|
15
|
+
t.text :raw
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
|
19
|
+
create_table :multiform_email_actions do |t|
|
20
|
+
t.integer :multiform_id
|
21
|
+
t.string :recipients
|
22
|
+
t.string :subject
|
23
|
+
t.timestamps
|
24
|
+
end
|
25
|
+
|
26
|
+
load(Rails.root.join('db', 'seeds', 'multiforms.rb'))
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.down
|
30
|
+
UserPlugin.destroy_all({:name => "Multiforms"})
|
31
|
+
|
32
|
+
# Page.delete_all({:link_url => "/multiforms"})
|
33
|
+
|
34
|
+
drop_table :multiform_email_actions
|
35
|
+
drop_table :multiform_submissions
|
36
|
+
drop_table :multiforms
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'refinery'
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Multiforms
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
initializer "static assets" do |app|
|
7
|
+
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
8
|
+
end
|
9
|
+
|
10
|
+
config.after_initialize do
|
11
|
+
puts "Registering Multiforms Plugin"
|
12
|
+
Refinery::Plugin.register do |plugin|
|
13
|
+
plugin.name = "refinerycms_multiforms"
|
14
|
+
plugin.menu_match = /(admin|refinery)\/(multiforms|email_actions)?$/
|
15
|
+
plugin.url = {:controller => '/admin/multiforms',:action => 'index'}
|
16
|
+
plugin.activity = {
|
17
|
+
:class => Multiform,
|
18
|
+
:title => 'title',
|
19
|
+
:url_prefix => 'edit'
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
puts "Registering Multiform Submission Plugin"
|
24
|
+
Refinery::Plugin.register do |plugin|
|
25
|
+
plugin.name = "refinerycms_multiforms_view"
|
26
|
+
plugin.menu_match = /(admin|refinery)\/submissions?$/
|
27
|
+
plugin.url = {:controller => '/admin/submissions',:action => 'index'}
|
28
|
+
plugin.activity = {
|
29
|
+
:class => MultiformSubmission,
|
30
|
+
:title => 'title',
|
31
|
+
:url_prefix => 'show'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Multiforms engine for Refinery CMS.
|
2
|
+
|
3
|
+
## How to build this engine as a gem
|
4
|
+
|
5
|
+
cd vendor/engines/multiforms
|
6
|
+
gem build refinerycms-multiforms.gempspec
|
7
|
+
gem install refinerycms-multiforms.gem
|
8
|
+
|
9
|
+
# Sign up for a http://rubygems.org/ account and publish the gem
|
10
|
+
gem push refinerycms-multiforms.gem
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: refinerycms-multiform
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jonathan Baughn
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-10-02 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email: jonathan@uitek.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- readme.md
|
29
|
+
files:
|
30
|
+
- readme.md
|
31
|
+
- lib/generators/refinerycms_multiforms_generator.rb
|
32
|
+
- lib/tasks/multiforms.rake
|
33
|
+
- lib/refinerycms_multiforms.rb
|
34
|
+
- app/models/multiform_submission.rb
|
35
|
+
- app/models/multiform.rb
|
36
|
+
- app/views/admin/submissions/show.html.erb
|
37
|
+
- app/views/admin/submissions/_multiform_submission.html.erb
|
38
|
+
- app/views/admin/submissions/index.html.erb
|
39
|
+
- app/views/admin/submissions/index_tmp.html.erb
|
40
|
+
- app/views/admin/multiforms/_multiform.html.erb
|
41
|
+
- app/views/admin/multiforms/_form.html.erb
|
42
|
+
- app/views/admin/multiforms/new.html.erb
|
43
|
+
- app/views/admin/multiforms/show.html.erb
|
44
|
+
- app/views/admin/multiforms/edit.html.erb
|
45
|
+
- app/views/admin/multiforms/index.html.erb
|
46
|
+
- app/views/admin/multiforms/_sortable_list.html.erb
|
47
|
+
- app/views/multiforms/show.html.erb
|
48
|
+
- app/views/multiforms/index.html.erb
|
49
|
+
- app/controllers/submissions_controller.rb
|
50
|
+
- app/controllers/admin/submissions_controller.rb
|
51
|
+
- app/controllers/admin/multiforms_controller.rb
|
52
|
+
- app/controllers/multiforms_controller.rb
|
53
|
+
- config/routes.rb
|
54
|
+
- config/locales/nb.yml
|
55
|
+
- config/locales/en.yml
|
56
|
+
- config/locales/nl.yml
|
57
|
+
- db/migrate/create_multiforms.rb
|
58
|
+
- db/seeds/multiforms.rb
|
59
|
+
has_rdoc: true
|
60
|
+
homepage: http://uitek.com
|
61
|
+
licenses: []
|
62
|
+
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options:
|
65
|
+
- --main
|
66
|
+
- readme.md
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
requirements: []
|
86
|
+
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 1.3.7
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: Provides user generated HTML forms
|
92
|
+
test_files: []
|
93
|
+
|