tb_banners 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +8 -8
  2. data/app/assets/javascripts/admin/banners/application.js +1 -0
  3. data/app/assets/stylesheets/admin/banners/application.css +4 -0
  4. data/app/controllers/{spud/admin → admin}/banner_sets_controller.rb +5 -5
  5. data/app/controllers/{spud/admin → admin}/banners_controller.rb +2 -2
  6. data/app/helpers/admin/banner_sets_helper.rb +2 -0
  7. data/app/helpers/admin/banners_helper.rb +2 -0
  8. data/app/views/admin/banner_sets/_banner_set.html.erb +8 -0
  9. data/app/views/admin/banner_sets/edit.html.erb +1 -0
  10. data/app/views/{spud/admin → admin}/banner_sets/index.html.erb +1 -1
  11. data/app/views/admin/banner_sets/new.html.erb +1 -0
  12. data/app/views/admin/banner_sets/show.html.erb +11 -0
  13. data/app/views/admin/banners/_banner.html.erb +7 -0
  14. data/app/views/admin/banners/edit.html.erb +1 -0
  15. data/app/views/{spud/admin → admin}/banners/legacy.js.erb +1 -1
  16. data/app/views/admin/banners/new.html.erb +1 -0
  17. data/config/routes.rb +7 -9
  18. data/lib/spud_banners/engine.rb +3 -3
  19. data/lib/spud_banners/version.rb +1 -1
  20. data/spec/controllers/{spud/admin → admin}/banner_sets_controller_spec.rb +2 -2
  21. data/spec/dummy/db/migrate/20130920154442_create_spud_roles.tb_core.rb +11 -0
  22. data/spec/dummy/db/migrate/20130920154443_create_spud_permissions.tb_core.rb +11 -0
  23. data/spec/dummy/db/migrate/20130920154444_create_spud_role_permissions.tb_core.rb +12 -0
  24. data/spec/dummy/db/migrate/20130920154445_drop_spud_admin_permissions.tb_core.rb +16 -0
  25. data/spec/dummy/db/migrate/20130920154446_create_spud_banners.tb_banners.rb +16 -0
  26. data/spec/dummy/db/migrate/20130920154447_create_spud_banner_sets.tb_banners.rb +13 -0
  27. data/spec/dummy/db/migrate/20130920154448_add_rich_text_to_spud_banners.tb_banners.rb +7 -0
  28. data/spec/dummy/db/schema.rb +36 -16
  29. data/spec/dummy/log/test.log +1001 -0
  30. data/spec/spec_helper.rb +1 -1
  31. metadata +56 -42
  32. data/app/assets/javascripts/spud/admin/banners/application.js +0 -2
  33. data/app/assets/stylesheets/spud/admin/banners/application.css +0 -4
  34. data/app/helpers/spud/admin/banner_sets_helper.rb +0 -2
  35. data/app/helpers/spud/admin/banners_helper.rb +0 -2
  36. data/app/views/spud/admin/banner_sets/_banner_set.html.erb +0 -8
  37. data/app/views/spud/admin/banner_sets/edit.html.erb +0 -1
  38. data/app/views/spud/admin/banner_sets/new.html.erb +0 -1
  39. data/app/views/spud/admin/banner_sets/show.html.erb +0 -11
  40. data/app/views/spud/admin/banners/_banner.html.erb +0 -7
  41. data/app/views/spud/admin/banners/edit.html.erb +0 -1
  42. data/app/views/spud/admin/banners/new.html.erb +0 -1
  43. /data/app/assets/images/{spud/admin → admin}/banners/banners.png +0 -0
  44. /data/app/assets/images/{spud/admin → admin}/banners/banners@2x.png +0 -0
  45. /data/app/assets/javascripts/{spud/admin → admin}/banners/banner_sets.js +0 -0
  46. /data/app/assets/javascripts/{spud/admin → admin}/banners/banners.js +0 -0
  47. /data/app/assets/stylesheets/{spud/admin → admin}/banners/banner_sets.css +0 -0
  48. /data/app/assets/stylesheets/{spud/admin → admin}/banners/banners.css +0 -0
  49. /data/app/views/{spud/admin → admin}/banner_sets/_form.html.erb +0 -0
  50. /data/app/views/{spud/admin → admin}/banner_sets/create.html.erb +0 -0
  51. /data/app/views/{spud/admin → admin}/banners/_form.html.erb +0 -0
  52. /data/app/views/{spud/admin → admin}/banners/show.html.erb +0 -0
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjkyNTEzYmI1MjM5YWU1YjdiMTk1OThhMGYwOGU0ODkwMTM5YmVjMw==
4
+ YjQ3MjEyYWJkZjdiNjEyN2VjMjQ1NWJlMzVmMjYyNTcxYWNhOTY1Yg==
5
5
  data.tar.gz: !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+ */
@@ -1,19 +1,19 @@
1
- class Spud::Admin::BannerSetsController < Spud::Admin::ApplicationController
1
+ class Admin::BannerSetsController < Admin::ApplicationController
2
2
 
3
3
  cache_sweeper :spud_banner_sweeper, :only => [:create, :update, :destroy]
4
4
  before_filter :get_record, :only => [:show, :edit, :update, :destroy]
5
5
  respond_to :html
6
6
  belongs_to_spud_app :banner_sets
7
- add_breadcrumb 'Banner Sets', :spud_admin_banner_sets_path
7
+ add_breadcrumb 'Banner Sets', :admin_banner_sets_path
8
8
  layout false
9
9
 
10
10
  def index
11
11
  @banner_sets = SpudBannerSet.all
12
- respond_with @banner_sets, :layout => 'spud/admin/detail'
12
+ respond_with @banner_sets, :layout => 'admin/detail'
13
13
  end
14
14
 
15
15
  def show
16
- respond_with @banner_set, :layout => 'spud/admin/detail'
16
+ respond_with @banner_set, :layout => 'admin/detail'
17
17
  end
18
18
 
19
19
  def new
@@ -60,7 +60,7 @@ private
60
60
  @banner_set = SpudBannerSet.find(params[:id])
61
61
  rescue ActiveRecord::RecordNotFound => e
62
62
  flash.now[:error] = "Could not find the requested BannerSet"
63
- redirect_to spud_admin_banner_sets_path
63
+ redirect_to admin_banner_sets_path
64
64
  return false
65
65
  end
66
66
  end
@@ -1,4 +1,4 @@
1
- class Spud::Admin::BannersController < Spud::Admin::ApplicationController
1
+ class Admin::BannersController < Admin::ApplicationController
2
2
 
3
3
  include RespondsToParent
4
4
 
@@ -96,7 +96,7 @@ private
96
96
  @banner = SpudBanner.find(params[:id])
97
97
  rescue ActiveRecord::RecordNotFound => e
98
98
  flash.now[:error] = "Could not find the requested SpudBanner"
99
- redirect_to spud_admin_banner_sets_path
99
+ redirect_to admin_banner_sets_path
100
100
  return false
101
101
  end
102
102
  end
@@ -0,0 +1,2 @@
1
+ module Admin::BannerSetsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Admin::BannersHelper
2
+ end
@@ -0,0 +1,8 @@
1
+ <%= content_tag :li, :class => 'spud_admin_banner_sets_list_item', 'data-id' => banner_set.id do %>
2
+ <%= banner_set.name %>
3
+ <span class="spud_admin_banner_sets_list_item_actions">
4
+ <%= link_to 'Manage Banners', admin_banner_set_path(banner_set), :class => 'btn btn-small' %>
5
+ <%= link_to 'Edit Configuration', edit_admin_banner_set_path(banner_set), :class => 'btn btn-small spud_banner_sets_edit' %>
6
+ <%= link_to 'Delete', admin_banner_set_path(banner_set), :class => 'btn btn-small btn-danger spud_banner_sets_delete' %>
7
+ </span>
8
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => admin_banner_set_path(@banner_set)} %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :data_controls do %>
2
- <%= link_to "New Banner Set", new_spud_admin_banner_set_path, :class => "btn btn-primary spud_banner_sets_add_new", :title => "New Banner Set" %>
2
+ <%= link_to "New Banner Set", new_admin_banner_set_path, :class => "btn btn-primary spud_banner_sets_add_new", :title => "New Banner Set" %>
3
3
  <% end %>
4
4
 
5
5
  <% content_for :detail do %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => admin_banner_sets_path} %>
@@ -0,0 +1,11 @@
1
+ <% content_for :data_controls do %>
2
+ <%= link_to 'Upload Banner', new_admin_banner_set_banner_path(@banner_set), :class => 'btn btn-primary spud_banner_add_new' %>
3
+ <% end %>
4
+
5
+ <div class="spud_banner_set_banners_container">
6
+ <%= render :partial => 'admin/banners/banner', :collection => @banner_set.banners %>
7
+ </div>
8
+
9
+ <script>
10
+ $(document).ready(spud.admin.banners.init);
11
+ </script>
@@ -0,0 +1,7 @@
1
+ <%= content_tag :div, 'data-id' => banner.id, :class => 'spud_banner_set_banner_item' do %>
2
+ <%= image_tag banner.banner.url(:spud_admin_small) %>
3
+ <div class="spud_banner_set_banner_item_actions">
4
+ <%= link_to 'Edit', edit_admin_banner_path(banner), :class => 'spud_banner_set_banner_item_edit' %>
5
+ <%= link_to 'Delete', admin_banner_path(banner), :class => 'spud_banner_set_banner_item_delete' %>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => admin_banner_path(@banner)} %>
@@ -1,5 +1,5 @@
1
1
  <% if @banner.errors.any? %>
2
- spud.admin.banners.onLegacyUploadError("<%= escape_javascript(render :partial => 'form', :locals => {:path => spud_admin_banner_set_banners_path(@banner_set)}) %>");
2
+ spud.admin.banners.onLegacyUploadError("<%= escape_javascript(render :partial => 'form', :locals => {:path => admin_banner_set_banners_path(@banner_set)}) %>");
3
3
  <% else %>
4
4
  spud.admin.banners.onLegacyUploadComplete("<%= escape_javascript(render :partial => 'banner', :locals => {:banner => @banner}) %>");
5
5
  <% end %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => admin_banner_set_banners_path(@banner_set)} %>
data/config/routes.rb CHANGED
@@ -1,14 +1,12 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
- namespace :spud, :path => '/' do
4
- namespace :admin do
5
- resources :banner_sets do
6
- resources :banners, :only => [:new, :create]
7
- end
8
- resources :banners, :only => [:show, :edit, :update, :destroy] do
9
- put :sort, :on => :collection
10
- end
3
+ namespace :admin do
4
+ resources :banner_sets do
5
+ resources :banners, :only => [:new, :create]
6
+ end
7
+ resources :banners, :only => [:show, :edit, :update, :destroy] do
8
+ put :sort, :on => :collection
11
9
  end
12
10
  end
13
11
 
14
- end
12
+ end
@@ -6,12 +6,12 @@ module Spud
6
6
  module Banners
7
7
  class Engine < Rails::Engine
8
8
  engine_name :tb_banners
9
- Spud::Core.append_admin_stylesheets('spud/admin/banners/application')
10
- Spud::Core.append_admin_javascripts('spud/admin/banners/application')
9
+ Spud::Core.append_admin_stylesheets('admin/banners/application')
10
+ Spud::Core.append_admin_javascripts('admin/banners/application')
11
11
  initializer :admin do
12
12
  Spud::Core.config.admin_applications += [{
13
13
  :name => 'Banner Sets',
14
- :thumbnail => 'spud/admin/banners/banners.png',
14
+ :thumbnail => 'admin/banners/banners.png',
15
15
  :retina => true,
16
16
  :url => '/admin/banner_sets',
17
17
  :order => 120
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Banners
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Spud::Admin::BannerSetsController do
3
+ describe Admin::BannerSetsController do
4
4
 
5
5
  before(:each) do
6
6
  activate_authlogic
@@ -31,7 +31,7 @@ describe Spud::Admin::BannerSetsController do
31
31
  it "should redirect if banner set is not found" do
32
32
  get :show, :id => -1
33
33
  assigns(:banner_set).should be_blank
34
- response.should redirect_to spud_admin_banner_sets_path
34
+ response.should redirect_to admin_banner_sets_path
35
35
  end
36
36
  end
37
37
 
@@ -0,0 +1,11 @@
1
+ # This migration comes from tb_core (originally 20130620143010)
2
+ class CreateSpudRoles < ActiveRecord::Migration
3
+ def change
4
+ create_table :spud_roles do |t|
5
+ t.string :name
6
+ t.timestamps
7
+ end
8
+ add_column :spud_users, :spud_role_id, :integer
9
+ add_index :spud_users, :spud_role_id
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # This migration comes from tb_core (originally 20130620143941)
2
+ class CreateSpudPermissions < ActiveRecord::Migration
3
+ def change
4
+ create_table :spud_permissions do |t|
5
+ t.string :name, :null => false
6
+ t.string :tag, :null => false
7
+ t.timestamps
8
+ end
9
+ add_index :spud_permissions, :tag, :unique => true
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ # This migration comes from tb_core (originally 20130620151132)
2
+ class CreateSpudRolePermissions < ActiveRecord::Migration
3
+ def change
4
+ create_table :spud_role_permissions do |t|
5
+ t.integer :spud_role_id, :null => false
6
+ t.string :spud_permission_tag, :null => false
7
+ t.timestamps
8
+ end
9
+ add_index :spud_role_permissions, :spud_role_id
10
+ add_index :spud_role_permissions, :spud_permission_tag
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ # This migration comes from tb_core (originally 20130620163144)
2
+ class DropSpudAdminPermissions < ActiveRecord::Migration
3
+ def up
4
+ drop_table :spud_admin_permissions
5
+ end
6
+
7
+ def down
8
+ create_table :spud_admin_permissions do |t|
9
+ t.integer :user_id
10
+ t.string :name
11
+ t.boolean :access
12
+ t.string :scope
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # This migration comes from tb_banners (originally 20121116195139)
2
+ class CreateSpudBanners < ActiveRecord::Migration
3
+ def change
4
+ create_table :spud_banners do |t|
5
+ t.integer :spud_banner_set_id, :null => false
6
+ t.string :link_to
7
+ t.string :link_target, :default => '_self'
8
+ t.string :title
9
+ t.string :alt
10
+ t.integer :sort_order, :default => 0
11
+ t.attachment :banner
12
+ t.timestamps
13
+ end
14
+ add_index :spud_banners, :spud_banner_set_id, :unique => false
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ # This migration comes from tb_banners (originally 20121116195312)
2
+ class CreateSpudBannerSets < ActiveRecord::Migration
3
+ def change
4
+ create_table :spud_banner_sets do |t|
5
+ t.string :name, :null => false
6
+ t.integer :width, :null => false
7
+ t.integer :height, :null => false
8
+ t.boolean :cropped, :default => true
9
+ t.timestamps
10
+ end
11
+ add_index :spud_banner_sets, :name, :unique => true
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from tb_banners (originally 20130614132846)
2
+ class AddRichTextToSpudBanners < ActiveRecord::Migration
3
+ def change
4
+ add_column :spud_banner_sets, :has_rich_text, :boolean, :default => false
5
+ add_column :spud_banners, :rich_text, :text
6
+ end
7
+ end
@@ -11,24 +11,16 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20121127192250) do
15
-
16
- create_table "spud_admin_permissions", :force => true do |t|
17
- t.integer "user_id"
18
- t.string "name"
19
- t.boolean "access"
20
- t.datetime "created_at", :null => false
21
- t.datetime "updated_at", :null => false
22
- t.string "scope"
23
- end
14
+ ActiveRecord::Schema.define(:version => 20130920154448) do
24
15
 
25
16
  create_table "spud_banner_sets", :force => true do |t|
26
- t.string "name", :null => false
27
- t.integer "width", :null => false
28
- t.integer "height", :null => false
29
- t.boolean "cropped", :default => true
30
- t.datetime "created_at", :null => false
31
- t.datetime "updated_at", :null => false
17
+ t.string "name", :null => false
18
+ t.integer "width", :null => false
19
+ t.integer "height", :null => false
20
+ t.boolean "cropped", :default => true
21
+ t.datetime "created_at", :null => false
22
+ t.datetime "updated_at", :null => false
23
+ t.boolean "has_rich_text", :default => false
32
24
  end
33
25
 
34
26
  add_index "spud_banner_sets", ["name"], :name => "index_spud_banner_sets_on_name", :unique => true
@@ -46,10 +38,36 @@ ActiveRecord::Schema.define(:version => 20121127192250) do
46
38
  t.datetime "banner_updated_at"
47
39
  t.datetime "created_at", :null => false
48
40
  t.datetime "updated_at", :null => false
41
+ t.text "rich_text"
49
42
  end
50
43
 
51
44
  add_index "spud_banners", ["spud_banner_set_id"], :name => "index_spud_banners_on_spud_banner_set_id"
52
45
 
46
+ create_table "spud_permissions", :force => true do |t|
47
+ t.string "name", :null => false
48
+ t.string "tag", :null => false
49
+ t.datetime "created_at", :null => false
50
+ t.datetime "updated_at", :null => false
51
+ end
52
+
53
+ add_index "spud_permissions", ["tag"], :name => "index_spud_permissions_on_tag", :unique => true
54
+
55
+ create_table "spud_role_permissions", :force => true do |t|
56
+ t.integer "spud_role_id", :null => false
57
+ t.string "spud_permission_tag", :null => false
58
+ t.datetime "created_at", :null => false
59
+ t.datetime "updated_at", :null => false
60
+ end
61
+
62
+ add_index "spud_role_permissions", ["spud_permission_tag"], :name => "index_spud_role_permissions_on_spud_permission_tag"
63
+ add_index "spud_role_permissions", ["spud_role_id"], :name => "index_spud_role_permissions_on_spud_role_id"
64
+
65
+ create_table "spud_roles", :force => true do |t|
66
+ t.string "name"
67
+ t.datetime "created_at", :null => false
68
+ t.datetime "updated_at", :null => false
69
+ end
70
+
53
71
  create_table "spud_user_settings", :force => true do |t|
54
72
  t.integer "spud_user_id"
55
73
  t.string "key"
@@ -79,9 +97,11 @@ ActiveRecord::Schema.define(:version => 20121127192250) do
79
97
  t.datetime "created_at", :null => false
80
98
  t.datetime "updated_at", :null => false
81
99
  t.string "time_zone"
100
+ t.integer "spud_role_id"
82
101
  end
83
102
 
84
103
  add_index "spud_users", ["email"], :name => "index_spud_users_on_email"
85
104
  add_index "spud_users", ["login"], :name => "index_spud_users_on_login"
105
+ add_index "spud_users", ["spud_role_id"], :name => "index_spud_users_on_spud_role_id"
86
106
 
87
107
  end