fullstack-cms 0.1.1

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 (125) hide show
  1. data/Gemfile +17 -0
  2. data/Gemfile.lock +289 -0
  3. data/README.md +28 -0
  4. data/Rakefile +53 -0
  5. data/VERSION +1 -0
  6. data/app/controllers/links_controller.rb +59 -0
  7. data/app/controllers/menus_controller.rb +40 -0
  8. data/app/controllers/page_parts_controller.rb +16 -0
  9. data/app/controllers/pages_controller.rb +21 -0
  10. data/app/controllers/posts_controller.rb +39 -0
  11. data/app/controllers/settings_controller.rb +39 -0
  12. data/app/controllers/tags_controller.rb +22 -0
  13. data/app/controllers/users_controller.rb +39 -0
  14. data/app/helpers/menus_helper.rb +42 -0
  15. data/app/helpers/pages_helper.rb +14 -0
  16. data/app/helpers/settings_helper.rb +7 -0
  17. data/app/models/.gitkeep +0 -0
  18. data/app/models/link.rb +17 -0
  19. data/app/models/menu.rb +19 -0
  20. data/app/models/page.rb +16 -0
  21. data/app/models/page_part.rb +6 -0
  22. data/app/models/redirect.rb +4 -0
  23. data/app/models/setting.rb +64 -0
  24. data/app/views/admin/links/_filter.html.erb +14 -0
  25. data/app/views/admin/links/_form.html.erb +24 -0
  26. data/app/views/admin/links/_index.html.erb +9 -0
  27. data/app/views/admin/links/_links.html.erb +128 -0
  28. data/app/views/admin/links/_table_row.html.erb +9 -0
  29. data/app/views/admin/links/create.js.erb +12 -0
  30. data/app/views/admin/links/sort.js.coffee +6 -0
  31. data/app/views/admin/links/update.js.coffee +6 -0
  32. data/app/views/admin/menus/_filter.html.erb +12 -0
  33. data/app/views/admin/menus/_form.html.erb +34 -0
  34. data/app/views/admin/menus/_index.html.erb +9 -0
  35. data/app/views/admin/page_parts/_tabs.html.erb +21 -0
  36. data/app/views/admin/page_parts/destroy.js.coffee +12 -0
  37. data/app/views/admin/pages/_collection.html.erb +7 -0
  38. data/app/views/admin/pages/_form.html.erb +54 -0
  39. data/app/views/admin/settings/_filter.html.erb +10 -0
  40. data/app/views/admin/settings/_form.html.erb +25 -0
  41. data/app/views/admin/settings/_index.html.erb +8 -0
  42. data/fullstack-cms.gemspec +189 -0
  43. data/lib/fullstack-cms.rb +1 -0
  44. data/lib/fullstack/cms.rb +41 -0
  45. data/lib/fullstack/cms/engine.rb +9 -0
  46. data/lib/generators/fullstack/cms/install_generator.rb +88 -0
  47. data/lib/generators/fullstack/cms/locale_generator.rb +11 -0
  48. data/lib/generators/fullstack/cms/templates/rails/README.md +40 -0
  49. data/lib/generators/fullstack/cms/templates/rails/app/controllers/site/site_controller.rb +10 -0
  50. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/attachments/_attachments.html.erb +49 -0
  51. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/attachments/create.js.coffee +14 -0
  52. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/base/destroy.js.coffee +7 -0
  53. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/base/edit.html.erb +8 -0
  54. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/base/index.html.erb +54 -0
  55. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/base/new.html.erb +8 -0
  56. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/base/update.js.coffee +5 -0
  57. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/dashboard/show.html.erb +0 -0
  58. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/links/_filter.html.erb +14 -0
  59. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/links/_form.html.erb +24 -0
  60. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/links/_index.html.erb +9 -0
  61. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/links/_links.html.erb +128 -0
  62. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/links/_table_row.html.erb +9 -0
  63. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/links/create.js.erb +12 -0
  64. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/links/sort.js.coffee +6 -0
  65. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/links/update.js.coffee +6 -0
  66. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/menus/_filter.html.erb +12 -0
  67. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/menus/_form.html.erb +34 -0
  68. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/menus/_index.html.erb +9 -0
  69. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/page_parts/_tabs.html.erb +21 -0
  70. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/page_parts/destroy.js.coffee +12 -0
  71. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/pages/_filter.html.erb +12 -0
  72. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/pages/_form.html.erb +50 -0
  73. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/pages/_index.html.erb +14 -0
  74. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/photogalleries/_filter.html.erb +14 -0
  75. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/photogalleries/_form.html.erb +26 -0
  76. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/photogalleries/_index.html.erb +9 -0
  77. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/settings/_filter.html.erb +10 -0
  78. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/settings/_form.html.erb +25 -0
  79. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/settings/_index.html.erb +8 -0
  80. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/shared/_nav.html.erb +38 -0
  81. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/users/_filter.html.erb +12 -0
  82. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/users/_form.html.erb +53 -0
  83. data/lib/generators/fullstack/cms/templates/rails/app/views/admin/users/_index.html.erb +18 -0
  84. data/lib/generators/fullstack/cms/templates/rails/app/views/layouts/admin.html.erb +80 -0
  85. data/lib/generators/fullstack/cms/templates/rails/app/views/layouts/application.html.erb +28 -0
  86. data/lib/generators/fullstack/cms/templates/rails/app/views/layouts/email.html.erb +167 -0
  87. data/lib/generators/fullstack/cms/templates/rails/app/views/site/_footer.html.erb +3 -0
  88. data/lib/generators/fullstack/cms/templates/rails/app/views/site/_google_analytics.html.erb +6 -0
  89. data/lib/generators/fullstack/cms/templates/rails/app/views/site/_head.html.erb +33 -0
  90. data/lib/generators/fullstack/cms/templates/rails/app/views/site/_header.html.erb +15 -0
  91. data/lib/generators/fullstack/cms/templates/rails/app/views/site/_javascripts.html.erb +22 -0
  92. data/lib/generators/fullstack/cms/templates/rails/app/views/site/_map.html.erb +14 -0
  93. data/lib/generators/fullstack/cms/templates/rails/app/views/site/_nav.html.erb +15 -0
  94. data/lib/generators/fullstack/cms/templates/rails/app/views/site/_share_buttons_big.html.erb +15 -0
  95. data/lib/generators/fullstack/cms/templates/rails/app/views/site/site/home.html.erb +12 -0
  96. data/lib/generators/fullstack/cms/templates/rails/config/initializers/devise_controller.rb +29 -0
  97. data/lib/generators/fullstack/cms/templates/rails/config/schedule.rb +5 -0
  98. data/lib/generators/fullstack/cms/templates/rails/config/sitemap.rb.tt +28 -0
  99. data/lib/generators/fullstack/cms/templates/rails/config/styles.yml +47 -0
  100. data/lib/generators/fullstack/cms/templates/rails/db/migrate/20120416071459_acts_as_taggable_on_migration.rb +31 -0
  101. data/lib/generators/fullstack/cms/templates/rails/db/migrate/20120730184641_create_friendly_id_slugs.rb +18 -0
  102. data/lib/generators/fullstack/cms/templates/rails/db/migrate/20120730204729_create_ckeditor_assets.rb +26 -0
  103. data/lib/generators/fullstack/cms/templates/rails/db/seeds.rb.tt +11 -0
  104. data/lib/generators/fullstack/cms/templates/rails/lib/support/ckeditor/asset.rb +4 -0
  105. data/lib/generators/fullstack/cms/templates/rails/lib/support/ckeditor/attachment_file.rb +12 -0
  106. data/lib/generators/fullstack/cms/templates/rails/lib/support/ckeditor/picture.rb +13 -0
  107. data/lib/generators/fullstack/cms/templates/rails/lib/support/content.rb +16 -0
  108. data/lib/generators/fullstack/cms/templates/rails/lib/support/pageable.rb +37 -0
  109. data/lib/generators/fullstack/cms/templates/rails/lib/support/timestamped_content.rb +12 -0
  110. data/lib/generators/fullstack/cms/templates/rails/lib/support/user_subject.rb +40 -0
  111. data/lib/generators/fullstack/cms/templates/rails/lib/tasks/.gitkeep +0 -0
  112. data/lib/generators/fullstack/cms/templates/rails/lib/tasks/assets.rake +53 -0
  113. data/lib/generators/fullstack/cms/templates/rails/lib/tasks/cms.rake +23 -0
  114. data/lib/generators/fullstack/cms/templates/rails/lib/tasks/remote.rake +255 -0
  115. data/lib/generators/fullstack/cms/templates/rails/public/404.html +43 -0
  116. data/lib/generators/fullstack/cms/templates/rails/public/422.html +26 -0
  117. data/lib/generators/fullstack/cms/templates/rails/public/500.html +25 -0
  118. data/lib/generators/fullstack/cms/templates/rails/public/apple-touch-icon.png +0 -0
  119. data/lib/generators/fullstack/cms/templates/rails/public/crossdomain.xml +25 -0
  120. data/lib/generators/fullstack/cms/templates/rails/public/favicon.ico +0 -0
  121. data/lib/generators/fullstack/cms/templates/rails/public/img/.gitignore +0 -0
  122. data/lib/generators/fullstack/cms/templates/rails/public/img/glyphicons-halflings.png +0 -0
  123. data/lib/generators/fullstack/cms/templates/rails/public/js/modernizr-2.5.3.min.js +4 -0
  124. data/lib/generators/fullstack/cms/templates/rails/public/robots.txt +4 -0
  125. metadata +333 -0
@@ -0,0 +1 @@
1
+ require "fullstack/cms"
@@ -0,0 +1,41 @@
1
+ # Author:: Maurizio Casimirri (mailto:maurizio.cas@gmail.com)
2
+ # Copyright:: Copyright (c) 2012 Maurizio Casimirri
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+
24
+ require "fullstack"
25
+ require "fullstack-admin"
26
+
27
+ require "ars-permalink"
28
+ require "has-attached"
29
+ require "acts-as-taggable-on"
30
+ require "acts_as_indexed"
31
+
32
+ require "rails_i18n_gettext"
33
+ require "sitemap"
34
+ require "whenever"
35
+
36
+ require 'fullstack/cms/engine'
37
+
38
+ module Fullstack
39
+ module Cms
40
+ end
41
+ end
@@ -0,0 +1,9 @@
1
+ require 'rails'
2
+
3
+ module Fullstack
4
+ module Cms
5
+ class Engine < ::Rails::Engine
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,88 @@
1
+ module Fullstack
2
+ module Cms
3
+ class InstallGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ class_option :host, :default => "remotehost"
7
+ class_option :user, :default => "ror"
8
+ class_option :title, :default => "title"
9
+ class_option :slogan, :default => "slogan"
10
+
11
+ def install_fullstack_admin
12
+ generate "fullstack:admin:install --host='#{host}' --user='#{user}' --title='#{title}' --slogan='#{slogan}'"
13
+ end
14
+
15
+ def install_libraries
16
+
17
+ generate "ars-permalink:install"
18
+ generate "has-attached:install"
19
+ generate "acts_as_taggable_on:migration"
20
+
21
+ end
22
+
23
+ def templates_tree
24
+ directory "rails", Rails.root
25
+ end
26
+
27
+
28
+ def english_localizations
29
+ generate "fullstack:cms:locale en"
30
+ end
31
+
32
+ def routes_rb
33
+
34
+ route "mount_controller 'site/site'"
35
+
36
+ route '''
37
+
38
+ constraints(:host => /#{Regexp.escape(Settings.app.domain)}/) do
39
+ root :to => redirect("http://www.#{Settings.app.domain}")
40
+ match \'/*path\', :to => redirect {|params| "http://www.#{Settings.app.domain}/#{params[:path]}"}
41
+ end
42
+
43
+ '''
44
+ end
45
+
46
+ def install_migrations
47
+ generate "migration:from link menu page_part page redirect setting"
48
+ end
49
+
50
+ protected
51
+
52
+ def migration_timestamp
53
+ Time.now.strftime("%Y%m%d%H%M%S")
54
+ end
55
+
56
+ def host
57
+ options[:host]
58
+ end
59
+
60
+ def domain
61
+ host
62
+ end
63
+
64
+ def user
65
+ options[:user]
66
+ end
67
+
68
+ def app
69
+ Rails.application.class.to_s.split("::").first.underscore
70
+ end
71
+
72
+ def email
73
+ "info@#{host}"
74
+ end
75
+
76
+ def title
77
+ options[:title]
78
+ end
79
+
80
+ def slogan
81
+ options[:slogan]
82
+ end
83
+
84
+ end
85
+ end
86
+ end
87
+
88
+
@@ -0,0 +1,11 @@
1
+ module Fullstack
2
+ module Cms
3
+ class LocaleGenerator < Rails::Generators::NamedBase
4
+
5
+ def install
6
+ generate "fullstack:admin:locale #{name}"
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,40 @@
1
+ # CMS Readme
2
+
3
+ ## Bootstrap the CMS
4
+
5
+ * Edit basic models if you wish
6
+ * run rake cms:bootstrap
7
+
8
+ This will
9
+
10
+ * generate migrations from models
11
+ * migrate the database
12
+ * seed the database
13
+
14
+
15
+ ## Steps to deploy
16
+
17
+ Configure Git Local/Remote
18
+
19
+ * rake remote:setup
20
+ * rake remote:init
21
+
22
+ Configure Apache
23
+
24
+ * rake remote:apache:ensite
25
+ * rake remote:apache:reload
26
+
27
+ First Deploy
28
+
29
+ * rake remote:deploy
30
+ * rake remote:db:migrate
31
+ * rake remote:db:seed
32
+
33
+ Install CRON Jobs from whenever
34
+ * rake remote:whenever
35
+
36
+ Precompile Assets
37
+ * rake remote:assets:precompile
38
+
39
+ Restart server
40
+ * rake remote:restart
@@ -0,0 +1,10 @@
1
+ class Site::SiteController < ApplicationController
2
+ include Pageable
3
+
4
+ authorize :scope => "site"
5
+
6
+ page :home, "/" do
7
+
8
+ end
9
+
10
+ end
@@ -0,0 +1,49 @@
1
+ <table class="table table-bordered">
2
+ <thead>
3
+ <tr>
4
+ <th><%= _("Title") %></th>
5
+ <th><%= _("Actions") %></th>
6
+ </tr>
7
+ </thead>
8
+ <tbody id="links_table_body">
9
+ <% attachable.attachments.each do |attachment| %>
10
+ <%= render :partial => "admin/attachments/table_row", :locals => {:attachment => attachment} %>
11
+ <% end %>
12
+ </tbody>
13
+ </table>
14
+
15
+ <div class="btn-toolbar">
16
+ <div class="btn-group">
17
+ <button class="btn btn-danger" data-toggle="collapse" data-target="#add_link_form">
18
+ <%= _("Add a new attachment") %>
19
+ </button>
20
+
21
+ </div>
22
+ </div>
23
+
24
+ <div id="add_link_form" class="collapse">
25
+
26
+ <div class="well">
27
+ <%= semantic_form_for [:"admin", Attachment.new(:attachable => attachable)], :html => {:multipart => true}, :remote => true do |f| -%>
28
+
29
+ <%= form_errors(f) %>
30
+ <%= f.inputs :class=>"hide" do %>
31
+ <%= f.input :attachable_id, :as => :hidden, :label => false %>
32
+ <%= f.input :attachable_type, :as => :hidden, :label => false %>
33
+ <% end %>
34
+
35
+ <%= f.inputs _("Add a new attachment"), :class => "clearable" do %>
36
+
37
+ <%= f.input :title %>
38
+ <%= f.input :description %>
39
+ <%= f.input :file %>
40
+
41
+ <% end -%>
42
+
43
+ <%= form_actions do %>
44
+ <%= button _("Add attachment"), :type => :primary %>
45
+ <% end %>
46
+
47
+ <% end -%>
48
+ </div>
49
+ </div>
@@ -0,0 +1,14 @@
1
+ <%= remotipart_response do %>
2
+ <% if @attachment.errors.empty? %>
3
+ $("#links_table_body").append('<%=j render(:partial => "admin/attachments/table_row", :locals => {:attachment => @attachment}) %>')
4
+ $("#add_link_form .clearable input").each ->
5
+ return $(this).val("")
6
+
7
+ $("#add_link_form").collapse('hide');
8
+ notify_notice('<%=j t("flash.success.create") %>')
9
+
10
+ <% else %>
11
+ notify_error('<%=j t("flash.error.create") %>')
12
+
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if instance_variable_get("@#{controller_name.singularize}").destroyed? %>
2
+ $("a[data-method='delete']").filter("[href='<%=j request.path %>']").closest("tr, li").remove()
3
+ notify_notice('<%=j t("flash.success.delete") %>')
4
+ <% else %>
5
+ notify_error('<%=j t("flash.error.delete") %>')
6
+ <% end %>
7
+
@@ -0,0 +1,8 @@
1
+ <% if content_for? :title -%>
2
+ <div class="page-header"><h1><%= yield :title %></h1></div>
3
+ <% else -%>
4
+ <div class="page-header"><h1><%= _("Edit") %> `<%= title_for(resource) %>`</h1></div>
5
+ <% end -%>
6
+
7
+ <%= render :partial => 'form' %>
8
+
@@ -0,0 +1,54 @@
1
+ <% if content_for? :title -%>
2
+ <div class="page-header"><h1><%= yield :title %></h1></div>
3
+ <% else -%>
4
+ <div class="page-header"><h1><%= t(plural_name, :scope => "active_record.plurals") %></h1></div>
5
+ <% end -%>
6
+
7
+ <div class="mb1">
8
+ <% if subject.can_create?(controller_name) && controller.action_methods.include?("new") %>
9
+ <%= link_to send("new_admin_#{controller_name.singularize}_path"), :class => "btn btn-primary" do %>
10
+ <i class="icon icon-plus icon-white"></i> <%= _("New") %>
11
+ <% end -%>
12
+ <% end %>
13
+
14
+ <%= link_to 'javascript:void(0)', :class => "btn toggle-delete" do %>
15
+ <i class="icon icon-trash"></i> <%= _("Delete") %>
16
+ <% end -%>
17
+
18
+ </div>
19
+
20
+ <table class="table table-bordered table-striped index-table">
21
+ <thead>
22
+ <tr>
23
+ <%= render :partial => 'index', :locals => {:thead => true, :tbody => false, :content => nil} %>
24
+ </tr>
25
+ </thead>
26
+ <tbody>
27
+ <% instance_variable_get("@#{controller_name}").each do |item| -%>
28
+ <tr>
29
+ <%= render :partial => 'index', :locals => {:thead => false, :tbody => true, :content => item} %>
30
+ </tr>
31
+ <% end -%>
32
+ </tbody>
33
+
34
+ </table>
35
+
36
+ <%= paginate instance_variable_get("@#{controller_name}"), :window => 4, :outer_window => 3 %>
37
+
38
+ <% content_for :aside do -%>
39
+
40
+ <% if partial?('filter') %>
41
+ <div class="well">
42
+ <div class="mb1">
43
+ <h4>Filtra</h4>
44
+ </div>
45
+ <%= semantic_form_for @search, :url => self.send("admin_#{collection_name}_path") , :html => {:method => :get} do |f| %>
46
+ <%= render :partial => "filter", :locals => {:f => f} %>
47
+ <%= f.buttons do %>
48
+ <%= f.commit_button _("Filter") %>
49
+ <% end %>
50
+ <% end %>
51
+ </div>
52
+ <% end %>
53
+ <% end -%>
54
+
@@ -0,0 +1,8 @@
1
+ <% if content_for? :title -%>
2
+ <div class="page-header"><h1><%= yield :title %></h1></div>
3
+ <% else -%>
4
+ <div class="page-header"><h1><%= _("New") %> <%= t(singular_name, :scope => "active_record.models") %></h1></div>
5
+ <% end -%>
6
+
7
+ <%= render :partial => 'form' %>
8
+
@@ -0,0 +1,5 @@
1
+ <% if instance_variable_get("@#{controller_name.singularize}").errors.empty? %>
2
+ notify_notice('<%=j t("flash.success.update") %>')
3
+ <% else %>
4
+ notify_error('<%=j t("flash.error.update") %>')
5
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <!-- https://github.com/ernie/meta_search -->
2
+ <!--
3
+ f.input :title_contains
4
+ f.input :created_at, :as => :daterange
5
+ -->
6
+
7
+
8
+ <%= f.input :label_contains %>
9
+
10
+
11
+
12
+ <%= f.input :created_at, :as => :daterange %>
13
+
14
+
@@ -0,0 +1,24 @@
1
+ <%= tabs do |t| %>
2
+ <%= t.pane _("Info") do %>
3
+ <%= semantic_form_for [:"admin", resource], :html => { :multipart => true, :'data-type' => :script }, :remote => true do |f| -%>
4
+
5
+ <%= form_errors(f) %>
6
+
7
+ <%= f.inputs do %>
8
+ <%= f.input :label %>
9
+ <%= f.input :description %>
10
+ <%= f.input :url %>
11
+ <%= f.input :image %>
12
+ <%= f.input :alignment_right %>
13
+
14
+ <% end -%>
15
+
16
+ <%= form_actions do %>
17
+ <%= button (resource.persisted? ? _("Update") : _("Create")), :type => :primary, :size => :large %>
18
+ <% end %>
19
+
20
+
21
+ <% end -%>
22
+
23
+ <% end %>
24
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <% if thead -%>
2
+ <th><%= sort_link title_method_for(collection.klass) %></th><th><%= sort_link :created_at %></th><th><%= _("Actions") %></th>
3
+ <% end -%>
4
+
5
+ <% if tbody -%>
6
+ <td><%= link_to title_for(content), [:edit, :admin, content] %></td>
7
+ <td><%= l content.created_at, :format => :pubdate %></td>
8
+ <td><%= default_collection_actions_for(content) %></td>
9
+ <% end -%>
@@ -0,0 +1,128 @@
1
+ <table class="table table-bordered">
2
+ <thead>
3
+ <tr>
4
+ <th colspan="2"><%= _("Label") %></th>
5
+ <th><%= _("Url") %></th>
6
+ <th><%= _("Actions") %></th>
7
+ </tr>
8
+ </thead>
9
+ <tbody id="links_table_body" class="sortable" data-update-url="<%= sort_admin_links_path %>">
10
+ <% link_owner.links.each do |link| %>
11
+ <%= render :partial => "admin/links/table_row", :locals => {:link => link} %>
12
+ <% end %>
13
+ </tbody>
14
+ </table>
15
+
16
+
17
+ <div id="add_link_form">
18
+
19
+ <div class="well">
20
+ <%= semantic_form_for [:"admin", link = Link.new(:link_owner => link_owner)], :html => {:multipart => true}, :remote => true do |f| -%>
21
+
22
+ <%= form_errors(f) %>
23
+ <%= f.inputs :class=>"hide" do %>
24
+ <%= f.input :link_owner_id, :as => :hidden, :label => false %>
25
+ <%= f.input :link_owner_type, :as => :hidden, :label => false %>
26
+ <% end %>
27
+
28
+ <%= f.inputs _("Add a new link"), :class => "clearable" do %>
29
+ <div class="row-fluid">
30
+ <div class="span8">
31
+ <%= f.input :label %>
32
+ <%= f.input :description %>
33
+
34
+ <div class="mb1">
35
+ </div>
36
+
37
+ <%= tabs do |t| %>
38
+ <%= t.pane(_("Link a Page")) do %>
39
+ <div class="clearfix" style="padding: 18px; min-height: 54px;">
40
+ <select class="select-resource-url" data-placeholder="<%= _('Choose a page by title') %>">
41
+ <option value=""></option>
42
+ <% Page.all.each do |page| %>
43
+ <option value="content://Page#<%= page.id %>"><%= page.title %></option>
44
+ <% end %>
45
+ </select>
46
+ </div>
47
+ <% end %>
48
+ <%= t.pane _("Insert by hand") do %>
49
+ <%= f.input :url %>
50
+ <% end %>
51
+ <% end %>
52
+
53
+
54
+
55
+ </div>
56
+ <div class="span4">
57
+ <div class="hide">
58
+ <%= f.input :alignment_right %>
59
+ </div>
60
+
61
+
62
+ <!-- =============== -->
63
+ <!-- = Image input = -->
64
+ <!-- =============== -->
65
+
66
+
67
+
68
+
69
+ <%= f.inputs "Immagine" do %>
70
+
71
+ <% if link.image.exists? %>
72
+ <ul class="thumbnails">
73
+ <li class="span3">
74
+ <a href="<%= link.image.url %>" target="blank" class="thumbnail">
75
+ <img src="<%= link.image.url(:thumb) %>"/>
76
+ </a>
77
+ </li>
78
+ </ul>
79
+ <% else %>
80
+ <div class="alert">
81
+ <a class="close" data-dismiss="alert">×</a>
82
+ Nessuna immagine caricata
83
+ </div>
84
+ <% end %>
85
+
86
+ <%= f.input :image, :as => :file, :hint => "Dimensione consigliata 800x600", :label => false %>
87
+
88
+ <% end %>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <!-- ================ -->
97
+ <!-- = ############ = -->
98
+ <!-- ================ -->
99
+ <%= f.input :icon %>
100
+ </div>
101
+ </div>
102
+
103
+
104
+ <% end -%>
105
+
106
+ <%= form_actions do %>
107
+ <%= button _("Add Link"), :type => :primary %>
108
+ <% end %>
109
+
110
+ <% end -%>
111
+
112
+ </div>
113
+ </div>
114
+
115
+
116
+
117
+
118
+ <% content_for :javascripts do -%>
119
+ <script type="text/javascript" charset="utf-8">
120
+ $(document).ready(function(){
121
+ $("select.select-resource-url").change(function(){
122
+ $("#link_url").val($("select.select-resource-url").val());
123
+ });
124
+
125
+ });
126
+
127
+ </script>
128
+ <% end -%>