adminpanel 0.0.7 → 0.1.0cl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -1
  3. data/app/controllers/adminpanel/clients_controller.rb +45 -0
  4. data/app/controllers/adminpanel/galleries_controller.rb +1 -1
  5. data/app/controllers/adminpanel/users_controller.rb +1 -1
  6. data/app/helpers/adminpanel/application_helper.rb +1 -1
  7. data/app/models/adminpanel/client.rb +11 -0
  8. data/app/models/adminpanel/section.rb +1 -2
  9. data/app/uploaders/adminpanel/{section_uploader.rb → client_uploader.rb} +7 -5
  10. data/app/views/adminpanel/clients/_client_form.html.erb +22 -0
  11. data/app/views/adminpanel/clients/edit.html.erb +9 -0
  12. data/app/views/adminpanel/clients/index.html.erb +53 -0
  13. data/app/views/adminpanel/clients/new.html.erb +9 -0
  14. data/app/views/adminpanel/clients/show.html.erb +18 -0
  15. data/app/views/adminpanel/galleries/index.html.erb +7 -7
  16. data/app/views/adminpanel/galleries/new.html.erb +3 -3
  17. data/app/views/adminpanel/products/_product_form.html.erb +1 -1
  18. data/app/views/adminpanel/products/index.html.erb +0 -2
  19. data/app/views/adminpanel/products/show.html.erb +1 -1
  20. data/app/views/adminpanel/sections/_image_fields.html.erb +1 -1
  21. data/app/views/adminpanel/sections/edit.html.erb +4 -4
  22. data/app/views/adminpanel/sections/show.html.erb +4 -5
  23. data/app/views/adminpanel/users/index.html.erb +12 -18
  24. data/app/views/adminpanel/users/new.html.erb +1 -1
  25. data/app/views/layouts/_side_menu.html.erb +22 -16
  26. data/app/views/layouts/_top_bar.html.erb +11 -11
  27. data/config/locales/es.yml +20 -2
  28. data/config/routes.rb +1 -0
  29. data/lib/adminpanel/version.rb +1 -1
  30. data/lib/generators/adminpanel/install/templates/migrations/create_adminpanel_tables.rb +7 -1
  31. data/spec/dummy/config/application.rb +2 -2
  32. data/spec/dummy/public/uploads/gallery/file/1/hipster.jpg +0 -0
  33. data/spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg +0 -0
  34. data/spec/features/categories_pages_spec.rb +3 -3
  35. data/spec/features/galleries_pages_spec.rb +57 -0
  36. data/spec/features/product_pages_spec.rb +15 -4
  37. data/spec/features/section_pages_spec.rb +38 -0
  38. data/spec/features/user_pages_spec.rb +49 -0
  39. data/spec/models/section_spec.rb +0 -2
  40. data/spec/support/define_factory_models.rb +19 -0
  41. data/spec/support/helper_methods.rb +16 -0
  42. data/spec/support/schema.rb +0 -1
  43. metadata +23 -6
  44. data/spec/uploaders/section_uploader_spec.rb +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA512:
3
- data.tar.gz: c1b2563a9b1c4c707c9653e0361a2fe667e1e06d4187d1191ae29b7f188ccd861ab5d231881e158266f1481a0b9c5b6920b317e96c6a227aab085d3e18c41dd0
4
- metadata.gz: 7c5526de8b8d50f76261a7b6973ec949020ad24da0dd6fc53c76394f135d526819f48304dfc186e69584acbfd318de30845d0021c48140016cebe0ab808440c8
3
+ data.tar.gz: 3ec3f7c88d058c6ccddc7998c704088b73e406e1c9d964777cf600a68aa24031a68304dcbe15dbd1ea3ffbbc553f5d0468ffabc9b2105889d6efae37e881ed34
4
+ metadata.gz: 591f31d3c086c95ca937c363576041d62e1895e2e6f8dd7925a496cbf8b5673758f7b13c6a7b2985ed5baec8bf497c8e170dd3fdeb33d5e8d0b70a5e9c849a58
5
5
  SHA1:
6
- data.tar.gz: a985bd1a3f33365906afb35f48d872c1829952cf
7
- metadata.gz: 1a829db829744d3dc281b3ac16ecd74618855d84
6
+ data.tar.gz: 87188479938bf9f0d71305622f5017355b1fb30e
7
+ metadata.gz: ccfea816f9624ede5eb1848370c3d32848540cf0
data/README.md CHANGED
@@ -35,7 +35,7 @@ Then, mount the gem wherever you like!
35
35
 
36
36
  mount Adminpanel::Engine => "/admin"
37
37
 
38
- Any doubts or errors feel free to ask me!
38
+ The version 0.1.0 is the first stable version, feel free to use it, any doubts or errors feel free to ask me!
39
39
 
40
40
  ## Contributing
41
41
 
@@ -49,3 +49,6 @@ Any doubts or errors feel free to ask me!
49
49
 
50
50
  1. Add english support
51
51
  2. Add the medium editor to the custom builder so it inits itself
52
+ 3. Get a section generator or some kind of it
53
+ 4. Add test to section edit(the only tests remaining)
54
+ 5. Add a generator that let you create scaffolded model/controller/view in way that you can change them in the main app.
@@ -0,0 +1,45 @@
1
+ module Adminpanel
2
+ class ClientsController < Adminpanel::ApplicationController
3
+ def index
4
+ @clients = Client.find(:all)
5
+ end
6
+
7
+ def show
8
+ @client = Client.find(params[:id])
9
+ end
10
+
11
+ def edit
12
+ @client = Client.find(params[:id])
13
+ end
14
+
15
+ def create
16
+ @client = Client.new(params[:client])
17
+
18
+ if @client.save
19
+ redirect_to client_path(@client), :notice => "El cliente ha sido guardado"
20
+ else
21
+ render 'new'
22
+ end
23
+ end
24
+
25
+ def destroy
26
+ @client = Client.find(params[:id])
27
+ @client.destroy
28
+
29
+ redirect_to clients_path, :notice => "El cliente ha sido eliminada"
30
+ end
31
+
32
+ def update
33
+ @client = Client.find(params[:id])
34
+ if @client.update_attributes(params[:client])
35
+ redirect_to client_path(@client)
36
+ else
37
+ render 'edit'
38
+ end
39
+ end
40
+
41
+ def new
42
+ @client = Client.new
43
+ end
44
+ end
45
+ end
@@ -16,7 +16,7 @@ module Adminpanel
16
16
  @gallery = Gallery.new(params[:gallery])
17
17
 
18
18
  if @gallery.save
19
- redirect_to gallery_path(@gallery), :notice => "La imagen ha sido creada"
19
+ redirect_to gallery_path(@gallery), :notice => t("gallery.success")
20
20
  else
21
21
  render 'new'
22
22
  end
@@ -45,7 +45,7 @@ module Adminpanel
45
45
 
46
46
  respond_to do |format|
47
47
  if @user.save
48
- format.html { redirect_to @user, :notice => 'Se ha creado con exito.' }
48
+ format.html { redirect_to @user, :notice => t("user.success") }
49
49
  format.json { render :json => @user, :status => :created, :location => @user }
50
50
  else
51
51
  format.html { render :action => "new" }
@@ -32,7 +32,7 @@ module Adminpanel
32
32
  render(association.to_s.singularize + "_fields", :f => builder, :model_name => model_name)
33
33
  end
34
34
  link_to(content_tag(:div, content_tag(:button,
35
- content_tag(:h6, name, :id => "add-estimate-button"),
35
+ content_tag(:h6, name, :id => "add-image-button"),
36
36
  :class => "btn btn-success btn-mini"), :class => "mws-form-row"),
37
37
  '#', :class => "add_fields", :data => {:id => id, :fields => fields.gsub("\n", "")})
38
38
  end
@@ -0,0 +1,11 @@
1
+ require "carrierwave"
2
+ require "carrierwave/orm/activerecord"
3
+ module Adminpanel
4
+ class Client < ActiveRecord::Base
5
+ attr_accessible :name, :logo
6
+ mount_uploader :logo, Adminpanel::ClientUploader
7
+
8
+ validates_presence_of :name
9
+ validates_presence_of :logo
10
+ end
11
+ end
@@ -2,10 +2,9 @@ require 'carrierwave'
2
2
  require 'carrierwave/orm/activerecord'
3
3
  module Adminpanel
4
4
  class Section < ActiveRecord::Base
5
- attr_accessible :description, :file, :has_image, :key, :name, :has_description, :images_attributes
5
+ attr_accessible :description, :has_image, :key, :name, :has_description, :images_attributes
6
6
  has_many :images, :foreign_key => "foreign_key", :conditions => { :model => "Section" }
7
7
  accepts_nested_attributes_for :images, :allow_destroy => true
8
- mount_uploader :file, Adminpanel::SectionUploader
9
8
  validates_length_of :description, :minimum => 10, :maximum => 10, :on => :update, :if => lambda{|section| section.key == "telephone"}
10
9
  validates_presence_of :description, :minimum => 9, :on => :update, :if => lambda{|section| section.has_description == true}
11
10
  validates :description, :numericality => { :only_integer => true }, :on => :update, :if => lambda{|section| section.key == "telephone"}
@@ -1,11 +1,10 @@
1
1
  # encoding: utf-8
2
2
  module Adminpanel
3
- class SectionUploader < CarrierWave::Uploader::Base
3
+ class ClientUploader < CarrierWave::Uploader::Base
4
4
 
5
5
  # Include RMagick or MiniMagick support:
6
6
  include CarrierWave::RMagick
7
7
  # include CarrierWave::MiniMagick
8
-
9
8
  # Choose what kind of storage to use for this uploader:
10
9
  storage :file
11
10
  # storage :fog
@@ -17,7 +16,7 @@ module Adminpanel
17
16
  # Override the directory where uploaded files will be stored.
18
17
  # This is a sensible default for uploaders that are meant to be mounted:
19
18
  def store_dir
20
- "uploads/section/#{mounted_as}/#{model.id}"
19
+ "uploads/client/#{mounted_as}/#{model.id}"
21
20
  end
22
21
 
23
22
  # Provide a default URL as a default if there hasn't been a file uploaded:
@@ -29,15 +28,18 @@ module Adminpanel
29
28
  # end
30
29
 
31
30
  # Process files as they are uploaded:
32
- # process :scale => [200, 300]
31
+ process :resize_to_fill => [1366, 768]
33
32
  #
34
33
  # def scale(width, height)
35
34
  # # do something
36
35
  # end
36
+ version :portfolio do
37
+ process :resize_to_fill => [240, 130]
38
+ end
37
39
 
38
40
  # Create different versions of your uploaded files:
39
41
  version :thumb do
40
- process :resize_to_limit => [460, 355]
42
+ process :resize_to_limit => [220, 220]
41
43
  end
42
44
 
43
45
  # Add a white list of extensions which are allowed to be uploaded.
@@ -0,0 +1,22 @@
1
+ <div class = "widget-body">
2
+ <div class = "widget-forms clearfix">
3
+ <%= custom_form_for(@client, :html => {:class => "form-horizontal"}) do |f| %>
4
+ <%= render 'shared/error_messages', :object => @client %>
5
+
6
+ <%= f.text_field :name, :label => "Nombre" -%>
7
+
8
+ <% if @client.logo %>
9
+ <div class="controls">
10
+ <div class="control-group">
11
+ <%= image_tag @client.logo_url(:thumb) %>
12
+ </div>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= f.custom_file_field :logo, :label => "Imagen" -%>
17
+ </div>
18
+ </div>
19
+ <div class = "widget-footer">
20
+ <%= f.submit t("client.new"), :disable_with => 'Submiting...' %>
21
+ </div>
22
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ <% provide(:page_title, "Editar") %>
2
+ <% breadcrumb_add(t("Clientes"), clients_path) %>
3
+ <% breadcrumb_add(@client.name, client_path(@client)) %>
4
+ <div class="row-fluid">
5
+ <div class = "widget widget-padding span12">
6
+ <div class = "widget-header"><i class = "icon-picture"></i><h5>Cliente</h5></div>
7
+ <%= render "client_form" %>
8
+ </div>
9
+ </div>
@@ -0,0 +1,53 @@
1
+ <%= provide(:page_title, "Clientes") %>
2
+ <div class="row-fluid">
3
+ <%=
4
+ link_to(
5
+ content_tag(:div,
6
+ content_tag(:i, nil, :class => 'icon-plus-sign icon-2x') + content_tag(:span, t("client.new"), nil),
7
+ :class => "btn btn-box span2"),
8
+ new_client_path,
9
+ :id => "new-client-button"
10
+ )
11
+ %>
12
+ </div>
13
+
14
+ <div class="row-fluid">
15
+ <div class="widget widget-padding span12">
16
+ <div class="widget-header">
17
+ <i class="icon-truck"></i>
18
+ <h5>Clientes</h5>
19
+ </div>
20
+ <div class="widget-body">
21
+ <div class="dataTables_wrapper form-inline">
22
+ <table id="information-table" class="table table-striped table-bordered dataTable">
23
+ <thead>
24
+ <tr>
25
+ <th>Nombre</th>
26
+ <th>Acción</th>
27
+ </tr>
28
+ </thead>
29
+ <tbody>
30
+ <% @clients.each do |client| %>
31
+ <tr>
32
+ <td><%= link_to client.name, client_path(client) %></td>
33
+ <td>
34
+ <%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_client_path(client), :title => t("action.edit") %>
35
+ <%= link_to content_tag(:i, nil, :class => 'icon-remove'), client_path(client),
36
+ :title => t("action.delete"),
37
+ :id => "client-delete",
38
+ :method => :delete,
39
+ :data => { :confirm => "Seguro?" }
40
+ %>
41
+ </td>
42
+ </tr>
43
+ <% end %>
44
+ </tbody>
45
+ </table>
46
+ <div class="row-fluid">
47
+ <div class="span6"></div>
48
+ <div class="span6"></div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
@@ -0,0 +1,9 @@
1
+ <% provide(:page_title, t("client.new")) %>
2
+ <% breadcrumb_add(t("model.Adminpanel::Client"), clients_path) %>
3
+ <div class="row-fluid">
4
+ <div class = "widget widget-padding span12">
5
+ <div class = "widget-header"><i class = "icon-picture"></i><h5>Cliente</h5></div>
6
+
7
+ <%= render 'client_form' %>
8
+ </div>
9
+ </div>
@@ -0,0 +1,18 @@
1
+ <% provide(:page_title, @client.name) %>
2
+ <% breadcrumb_add("Clientes", clients_path) %>
3
+
4
+ <div class="row-fluid">
5
+ <div class="widget widget-padding span12">
6
+ <div class="widget-header">
7
+ <i class="icon-picture"></i>
8
+ <h5><%= @client.name %>
9
+ <%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_client_path(@client), :title => "Editar Cliente" %>
10
+ </h5>
11
+ </div>
12
+ <div class="widget-body row-fluid">
13
+ <div class="span12">
14
+ <%= image_tag @client.logo_url %>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ </div>
@@ -1,4 +1,4 @@
1
- <%= provide(:page_title, t("Gallery")) %>
1
+ <%= provide(:page_title, t("model.Adminpanel::Gallery")) %>
2
2
  <div class="row-fluid">
3
3
  <%=
4
4
  link_to(
@@ -11,7 +11,7 @@
11
11
  ) +
12
12
  content_tag(
13
13
  :span,
14
- 'Agregar Imagen',
14
+ t("gallery.new"),
15
15
  nil
16
16
  ),
17
17
  :class => "btn btn-box span2"
@@ -25,7 +25,7 @@
25
25
  <div class="widget widget-padding span12">
26
26
  <div class="widget-header">
27
27
  <i class="icon-picture"></i>
28
- <h5>Galería de Inicio</h5>
28
+ <h5><%= t("model.Adminpanel::Gallery") %></h5>
29
29
  </div>
30
30
  <div class="widget-body">
31
31
  <div class="dataTables_wrapper form-inline">
@@ -33,7 +33,7 @@
33
33
  <thead>
34
34
  <tr>
35
35
  <th>Imagen</th>
36
- <th>Acción</th>
36
+ <th>Acción</th>
37
37
  </tr>
38
38
  </thead>
39
39
  <tbody>
@@ -41,9 +41,9 @@
41
41
  <tr>
42
42
  <td><%= link_to image_tag(gallery.file_url(:thumb)), gallery_path(gallery) %></td>
43
43
  <td>
44
- <%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_gallery_path(gallery), :title => "Editar"%>
45
- <%= link_to content_tag(:i, nil, :class => 'icon-remove'), gallery_path(gallery), :title => "Borrar", :method => :delete,
46
- :data => { :confirm => "Seguro?" }
44
+ <%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_gallery_path(gallery), :title => t("action.edit") %>
45
+ <%= link_to content_tag(:i, nil, :class => 'icon-remove'), gallery_path(gallery), :title => t("action.delete"), :method => :delete,
46
+ :data => { :confirm => t("action.delete confirmation") }
47
47
  %>
48
48
  </td>
49
49
  </tr>
@@ -1,5 +1,5 @@
1
- <% provide(:page_title, "Nueva Imagen") %>
2
- <% breadcrumb_add(t("Gallery"), galleries_path) %>
1
+ <% provide(:page_title, t("gallery.new")) %>
2
+ <% breadcrumb_add(t("model.Adminpanel::Gallery"), galleries_path) %>
3
3
  <div class="row-fluid">
4
4
  <div class = "widget widget-padding span12">
5
5
  <div class = "widget-header"><i class = "icon-picture"></i><h5>Imagen</h5></div>
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  </div>
13
13
  <div class = "widget-footer">
14
- <%= f.submit "Agregar", :disable_with => 'Submiting...' %>
14
+ <%= f.submit t("gallery.new"), :disable_with => 'Submiting...' %>
15
15
  </div>
16
16
  <% end -%>
17
17
  </div>
@@ -12,7 +12,7 @@
12
12
  <% if @product.description.nil? %>
13
13
  <%= content_tag(:div, @product.description, :class => "editable", "data-placeholder" => t("Write description here")) %>
14
14
  <% else %>
15
- <%= content_tag(:div, @product.description.html_safe, :class => "editable", "data-placeholder" => t("Write description here")) %>
15
+ <%= content_tag(:div, @product.description.html_safe, :class => "editable controls", "data-placeholder" => t("Write description here")) %>
16
16
  <% end %>
17
17
  </div>
18
18
  </div>
@@ -31,14 +31,12 @@
31
31
  <tr>
32
32
  <td><%= link_to product.name, product_path(product) %></td>
33
33
  <td><%= strip_tags product.description %></td>
34
- <% #if can? :manage, product %>
35
34
  <td>
36
35
  <%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_product_path(product), :title => "Editar"%>
37
36
  <%= link_to content_tag(:i, nil, :class => 'icon-remove'), product_path(product), :title => "Borrar", :method => :delete,
38
37
  :data => { :confirm => "Seguro?" }
39
38
  %>
40
39
  </td>
41
- <% #end %>
42
40
  </tr>
43
41
  <% end %>
44
42
  </tbody>
@@ -40,7 +40,7 @@
40
40
  </ul></div>
41
41
  </div>
42
42
  </div>
43
- <div class="widget widget-padding span6">
43
+ <div id="product-content" class="widget widget-padding span6">
44
44
  <div class="widget-header">
45
45
  <i class="icon-truck"></i>
46
46
  <h5>Galería: <%= @product.name.humanize %>
@@ -7,7 +7,7 @@
7
7
  </div>
8
8
  <% end %>
9
9
  <div class="control-group">
10
- <%= f.label t("model.Image"), :class => "control-label" %>
10
+ <%= f.label t("model.Adminpanel::Image"), :class => "control-label" %>
11
11
  <div class="controls">
12
12
  <%= f.file_field :file %>
13
13
  <%= f.hidden_field :model, :value => model_name %>
@@ -1,4 +1,4 @@
1
- <% provide(:page_title, "Editar") %>
1
+ <% provide(:page_title, t("section.edit")) %>
2
2
  <% breadcrumb_add('Secciones', sections_path) %>
3
3
  <% breadcrumb_add(@section.name, section_path(@section)) %>
4
4
  <div class="row-fluid">
@@ -11,7 +11,7 @@
11
11
 
12
12
  <% if @section.has_description %>
13
13
  <div class="control-group">
14
- <label class="control-label"><%= t "Description" %></label>
14
+ <label class="control-label"><%= t("model.attributes.Adminpanel::Section.description") %></label>
15
15
  <div class="controls">
16
16
  <%= f.hidden_field :description, :id => "description-field" %>
17
17
  <% if @section.description.nil? %>
@@ -22,7 +22,7 @@
22
22
  </div>
23
23
  </div>
24
24
  <% else %>
25
- <%= f.text_field :description, :label => t("Description") %>
25
+ <%= f.text_field :description, :label => t("model.attributes.Adminpanel::Section.description") %>
26
26
  <% end %>
27
27
 
28
28
  <% if @section.has_image %>
@@ -35,7 +35,7 @@
35
35
  </div>
36
36
  </div>
37
37
  <div class = "widget-footer">
38
- <%= f.submit "Guardar", :disable_with => 'Submiting...', :id => "save-button" %>
38
+ <%= f.submit t("action.save"), :disable_with => t("action.submiting"), :id => "save-button" %>
39
39
  </div>
40
40
  <% end -%>
41
41
  </div>
@@ -10,22 +10,21 @@
10
10
  </h5>
11
11
  </div>
12
12
  <div class="widget-body row-fluid">
13
- <div class="span1">
13
+
14
+ <div class="span2">
14
15
  <b>Descripción</b>
15
16
  </div>
16
- <div class="span11">
17
+ <div class="span10">
17
18
  <% if @section.description.nil? %>
18
- <%= t("no description") %>
19
+ <%= t("other.no description") %>
19
20
  <% else %>
20
21
  <%= @section.description.html_safe %>
21
22
  <% end %>
22
23
  </div>
23
24
  <div class="span12">
24
- <% if @section.has_image %>
25
25
  <% @section.images.each do |image|-%>
26
26
  <%= image_tag(image.file_url :thumb) %>
27
27
  <% end %>
28
- <% end %>
29
28
  </div>
30
29
  </div>
31
30
  </div>
@@ -1,16 +1,14 @@
1
- <%= provide(:page_title, "Usuarios") %>
2
- <% #if can? :create, Client %>
3
- <div class="row-fluid">
4
- <%=
5
- link_to(
6
- content_tag(:div,
7
- content_tag(:i, nil, :class => 'icon-plus-sign icon-2x') + content_tag(:span, 'Agregar Usuario', nil),
8
- :class => "btn btn-box span2"),
9
- new_user_path
10
- )
11
- %>
12
- </div>
13
- <% #end %>
1
+ <%= provide(:page_title, t("model.Adminpanel::User")) %>
2
+ <div class="row-fluid">
3
+ <%=
4
+ link_to(
5
+ content_tag(:div,
6
+ content_tag(:i, nil, :class => 'icon-plus-sign icon-2x') + content_tag(:span, t("user.new"), nil),
7
+ :class => "btn btn-box span2"),
8
+ new_user_path
9
+ )
10
+ %>
11
+ </div>
14
12
 
15
13
  <div class="row-fluid">
16
14
  <div class="widget widget-padding span12">
@@ -24,23 +22,19 @@
24
22
  <thead>
25
23
  <tr>
26
24
  <th>Nombre</th>
27
- <% #if can? :manage, Client %>
28
- <th>Acción</th>
29
- <% #end %>
25
+ <th>Acción</th>
30
26
  </tr>
31
27
  </thead>
32
28
  <tbody>
33
29
  <% @users.each do |user| %>
34
30
  <tr>
35
31
  <td><%= link_to user.name, user_path(user) %></td>
36
- <% #if can? :manage, user %>
37
32
  <td>
38
33
  <%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_user_path(user), :title => "Editar"%>
39
34
  <%= link_to content_tag(:i, nil, :class => 'icon-remove'), user_path(user), :title => "Borrar", :method => :delete,
40
35
  :data => { :confirm => "Seguro?" }
41
36
  %>
42
37
  </td>
43
- <% #end %>
44
38
  </tr>
45
39
  <% end %>
46
40
  </tbody>
@@ -1,4 +1,4 @@
1
- <% provide(:page_title, "Nuevo") %>
1
+ <% provide(:page_title, t("user.new")) %>
2
2
  <% breadcrumb_add('Usuarios', users_path) %>
3
3
 
4
4
  <div class="row-fluid">
@@ -10,29 +10,35 @@
10
10
  <% end %>
11
11
  <div class="accordion" id="accordion2">
12
12
 
13
- <div class="accordion-group">
14
- <div class="accordion-heading">
15
- <%= link_to content_tag(:i, nil, :class => 'icon-truck') + content_tag(:span, ' Productos'), products_path, :class => "accordion-toggle b_F79999 #{is_current_section?('products')}" %>
16
- </div>
13
+ <div class="accordion-group">
14
+ <div class="accordion-heading">
15
+ <%= link_to content_tag(:i, nil, :class => 'icon-truck') + content_tag(:span, ' Productos'), products_path, :class => "accordion-toggle b_F79999 #{is_current_section?('products')}" %>
17
16
  </div>
17
+ </div>
18
18
 
19
- <div class="accordion-group">
20
- <div class="accordion-heading">
21
- <%= link_to content_tag(:i, nil, :class => 'icon-user') + content_tag(:span, ' Usuarios'), users_path, :class => "accordion-toggle b_9FDDF6 #{is_current_section?('users')}" %>
22
- </div>
19
+ <div class="accordion-group">
20
+ <div class="accordion-heading">
21
+ <%= link_to content_tag(:i, nil, :class => 'icon-user') + content_tag(:span, ' Usuarios'), users_path, :class => "accordion-toggle b_9FDDF6 #{is_current_section?('users')}" %>
23
22
  </div>
23
+ </div>
24
24
 
25
- <div class="accordion-group">
26
- <div class="accordion-heading">
27
- <%= link_to content_tag(:i, nil, :class => 'icon-picture') + content_tag(:span, " #{t("model.Adminpanel::Gallery")}"), galleries_path, :class => "accordion-toggle b_C3F7A7 #{is_current_section?('galleries')}" %>
28
- </div>
25
+ <div class="accordion-group">
26
+ <div class="accordion-heading">
27
+ <%= link_to content_tag(:i, nil, :class => 'icon-picture') + content_tag(:span, " #{t("model.Adminpanel::Gallery")}"), galleries_path, :class => "accordion-toggle b_C3F7A7 #{is_current_section?('galleries')}" %>
29
28
  </div>
29
+ </div>
30
30
 
31
- <div class="accordion-group">
32
- <div class="accordion-heading">
33
- <%= link_to content_tag(:i, nil, :class => 'icon-tasks') + content_tag(:span, ' Secciones'), sections_path, :class => "accordion-toggle b_F6F1A2 #{is_current_section?('sections')}" %>
34
- </div>
31
+ <div class="accordion-group">
32
+ <div class="accordion-heading">
33
+ <%= link_to content_tag(:i, nil, :class => 'icon-tasks') + content_tag(:span, ' Secciones'), sections_path, :class => "accordion-toggle b_F6F1A2 #{is_current_section?('sections')}" %>
34
+ </div>
35
+ </div>
36
+
37
+ <div class="accordion-group">
38
+ <div class="accordion-heading">
39
+ <%= link_to content_tag(:i, nil, :class => 'icon-star') + content_tag(:span, ' Clientes'), clients_path, :class => "accordion-toggle b_9FDDF6 #{is_current_section?('clients')}" %>
35
40
  </div>
41
+ </div>
36
42
 
37
43
  <div class="accordion-group">
38
44
  <div class="accordion-heading">
@@ -5,17 +5,17 @@
5
5
  <%= link_to image_tag("logo.png", :alt => "PCP del Sureste"), root_path %>
6
6
  </div>
7
7
  <% if signed_in? %>
8
- <a class="btn btn-navbar visible-phone" data-toggle="collapse" data-target=".nav-collapse">
9
- <span class="icon-bar"></span>
10
- <span class="icon-bar"></span>
11
- <span class="icon-bar"></span>
12
- </a>
13
- <% end %>
14
- <a class="btn btn-navbar slide_menu_left visible-tablet">
15
- <span class="icon-bar"></span>
16
- <span class="icon-bar"></span>
17
- <span class="icon-bar"></span>
18
- </a>
8
+ <a class="btn btn-navbar visible-phone" data-toggle="collapse" data-target=".nav-collapse">
9
+ <span class="icon-bar"></span>
10
+ <span class="icon-bar"></span>
11
+ <span class="icon-bar"></span>
12
+ </a>
13
+ <a class="btn btn-navbar slide_menu_left visible-tablet">
14
+ <span class="icon-bar"></span>
15
+ <span class="icon-bar"></span>
16
+ <span class="icon-bar"></span>
17
+ </a>
18
+ <% end %>
19
19
 
20
20
  <div class="top-menu visible-desktop">
21
21
  <ul class="pull-right">
@@ -6,6 +6,7 @@ es:
6
6
  Adminpanel::Section: "Sección"
7
7
  Adminpanel::Image: "Imagen"
8
8
  Adminpanel::Category: "Categoría"
9
+ Adminpanel::Client: "Cliente"
9
10
  attributes:
10
11
  Adminpanel::User:
11
12
  email: "Correo electrónico"
@@ -20,6 +21,9 @@ es:
20
21
  file: "Imagen"
21
22
  Adminpanel::Category:
22
23
  name: "Nombre"
24
+ Adminpanel::Client:
25
+ name: "Nombre"
26
+ logo: "Nombre"
23
27
  Adminpanel::Product:
24
28
  name: "Nombre"
25
29
  brief: "Pequeña descripción"
@@ -90,9 +94,11 @@ es:
90
94
  Panel title: "Panel Administrativo"
91
95
  New: "Nuevo"
92
96
  action:
97
+ submiting: "Enviando..."
93
98
  save: "Guardar"
94
99
  edit: "Editar"
95
100
  delete: "Eliminar"
101
+ delete confirmation: "Estás seguro que desea eliminar?"
96
102
  authentication:
97
103
  welcome: "Bienvenido! Inicia Sesión"
98
104
  signin error: "Contraseña incorrecta"
@@ -101,8 +107,20 @@ es:
101
107
  new: "Agregar Categoría"
102
108
  success: "La categoría ha sido guardada"
103
109
  product:
104
- new: "Agregar Producto"
110
+ new: "Agregar Producto"
105
111
  success: "El producto ha sido guardado"
112
+ gallery:
113
+ new: "Agregar Imagen"
114
+ success: "La imagen ha sido guardada"
115
+ user:
116
+ new: "Agregar Usuario"
117
+ success: "El usuario ha sido guardado"
118
+ client:
119
+ new: "Agregar Cliente"
120
+ section:
121
+ edit: "Editar Sección"
106
122
  session:
107
123
  password: "Contraseña"
108
- email: "Correo electrónico"
124
+ email: "Correo electrónico"
125
+ other:
126
+ no description: "No tiene descripción aún"
data/config/routes.rb CHANGED
@@ -4,6 +4,7 @@ Adminpanel::Engine.routes.draw do
4
4
  resources :galleries
5
5
  resources :sessions, :only => [:new, :create, :destroy]
6
6
  resources :products
7
+ resources :clients
7
8
  resources :categories
8
9
  root :to => 'products#index'
9
10
  match '/signout', :to => 'sessions#destroy', :via => :delete, :as => "signout"
@@ -1,3 +1,3 @@
1
1
  module Adminpanel
2
- VERSION = "0.0.7"
2
+ VERSION = "0.1.0cl"
3
3
  end
@@ -36,9 +36,15 @@ class CreateAdminpanelTables < ActiveRecord::Migration
36
36
  t.text :description
37
37
  t.string :key
38
38
  t.boolean :has_image
39
- t.string :file
40
39
  t.timestamps
41
40
  end
41
+
42
+ create_table :adminpanel_clients do |t|
43
+ t.string :name
44
+ t.string :logo
45
+ t.timestamps
46
+ end
47
+
42
48
  add_index :adminpanel_sections, [:key]
43
49
 
44
50
  create_table :adminpanel_categories do |t|
@@ -28,8 +28,8 @@ module Dummy
28
28
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
29
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
30
  config.i18n.default_locale = :es
31
- config.i18n.enforce_available_locales = false
32
-
31
+ I18n.config.enforce_available_locales = true
32
+
33
33
  # Configure the default encoding used in templates for Ruby 1.9.
34
34
  config.encoding = "utf-8"
35
35
 
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "Categories" do
3
+ describe "Categories pages" do
4
4
  subject {page}
5
5
 
6
6
  let(:user) { Factory(:user) }
@@ -9,7 +9,7 @@ describe "Categories" do
9
9
  valid_signin(user)
10
10
  end
11
11
 
12
- describe "categories index" do
12
+ describe "index" do
13
13
  let(:category) { Factory(:category) }
14
14
  before do
15
15
  visit adminpanel.categories_path
@@ -20,7 +20,7 @@ describe "Categories" do
20
20
  it { should have_link("i", adminpanel.edit_category_path(category)) }
21
21
  end
22
22
 
23
- describe "create category" do
23
+ describe "new" do
24
24
  before { visit adminpanel.new_category_path }
25
25
 
26
26
  it { should have_title(I18n.t("category.new")) }
@@ -0,0 +1,57 @@
1
+ require "spec_helper"
2
+
3
+ describe "Gallery pages" do
4
+ subject {page}
5
+
6
+ let(:user) { Factory(:user) }
7
+ before do
8
+ visit adminpanel.signin_path
9
+ valid_signin(user)
10
+ clean_uploads_folder
11
+ end
12
+
13
+ describe "galleries" do
14
+ let(:gallery) { Factory(:gallery) }
15
+ before do
16
+ visit adminpanel.galleries_path
17
+ end
18
+
19
+ it { should have_link(I18n.t("gallery.new"), adminpanel.new_gallery_path)}
20
+ it { should have_link("i", adminpanel.gallery_path(gallery)) }
21
+ it { should have_link("i", adminpanel.edit_gallery_path(gallery)) }
22
+ end
23
+
24
+ describe "new" do
25
+ before do
26
+ visit adminpanel.new_gallery_path
27
+ end
28
+
29
+ it { should have_title(I18n.t("gallery.new")) }
30
+
31
+ describe "with invalid information" do
32
+ before { find("form#new_gallery").submit_form! }
33
+
34
+ it { should have_title(I18n.t("gallery.new")) }
35
+ it { should have_selector("div#alerts") }
36
+ end
37
+
38
+ describe "with valid information" do
39
+ before do
40
+ attach_file('gallery_file', File.join(Rails.root, '/app/assets/images/hipster.jpg'))
41
+ find("form#new_gallery").submit_form!
42
+ end
43
+
44
+ it { should have_content(I18n.t("gallery.success"))}
45
+ it { File.exists? File.join(Rails.root, '/public/uploads/gallery/file/1/thumb_hipster.jpg') }
46
+ end
47
+ end
48
+
49
+ describe "show" do
50
+ let(:gallery) { Factory(:gallery) }
51
+ before do
52
+ visit adminpanel.gallery_path(gallery)
53
+ end
54
+
55
+ it { page.should have_selector("img", :src => gallery.file_url) }
56
+ end
57
+ end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "Products" do
3
+ describe "Product pages" do
4
4
  subject {page}
5
5
 
6
6
  let(:user) { Factory(:user) }
@@ -9,7 +9,7 @@ describe "Products" do
9
9
  valid_signin(user)
10
10
  end
11
11
 
12
- describe "products index" do
12
+ describe "index" do
13
13
  let(:product) { Factory(:product) }
14
14
  before do
15
15
  visit adminpanel.products_path
@@ -20,7 +20,7 @@ describe "Products" do
20
20
  it { should have_link("i", adminpanel.edit_product_path(product)) }
21
21
  end
22
22
 
23
- describe "create product" do
23
+ describe "new" do
24
24
  let(:category) { Factory(:category) }
25
25
  before do
26
26
  category.id = 1 #to force instantiation so it becomes available in the select
@@ -47,7 +47,18 @@ describe "Products" do
47
47
 
48
48
  it { should have_content(I18n.t("product.success"))}
49
49
  end
50
+ end
51
+
52
+ describe "show" do
53
+ let(:product) { Factory(:product) }
54
+
55
+ before do
56
+ visit adminpanel.product_path(product)
57
+ end
50
58
 
51
- describe
59
+ it { page.should have_selector("div", :text => product.name.humanize) }
60
+ it { page.should have_selector("div", :text => product.brief) }
61
+ it { page.should have_selector("div", :text => product.description) }
62
+ it { page.should have_selector("div", :text => product.category.name) }
52
63
  end
53
64
  end
@@ -0,0 +1,38 @@
1
+ require "spec_helper"
2
+
3
+ describe "Section pages" do
4
+ subject {page}
5
+
6
+ let(:user) { Factory(:user) }
7
+ before do
8
+ visit adminpanel.signin_path
9
+ valid_signin(user)
10
+ end
11
+
12
+ describe "index" do
13
+ let(:section) { Factory(:section_with_gallery) }
14
+ before do
15
+ visit adminpanel.sections_path
16
+ end
17
+
18
+ it { should have_link("i", adminpanel.section_path(section)) }
19
+ it { should have_link("i", adminpanel.edit_section_path(section)) }
20
+ end
21
+
22
+ describe "show" do
23
+ describe "with gallery" do
24
+ let(:section) { Factory(:section_with_gallery) }
25
+ let(:image) { Factory(:image_section, :foreign_key => section.id) }
26
+ # let(:image2) { Factory(:image_section, :foreign_key => section.id) }
27
+ # let(:image3) { Factory(:image_section, :foreign_key => section.id) }
28
+
29
+ before do
30
+ visit adminpanel.section_path(section)
31
+ end
32
+
33
+ it { should have_title(section.name.humanize) }
34
+ it { should have_content(section.description) }
35
+ it { should have_link("i", adminpanel.edit_section_path(section)) }
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,49 @@
1
+ require "spec_helper"
2
+
3
+ describe "User pages" do
4
+ subject {page}
5
+
6
+ let(:user) { Factory(:user) }
7
+ before do
8
+ visit adminpanel.signin_path
9
+ valid_signin(user)
10
+ end
11
+
12
+ describe "index" do
13
+ before do
14
+ visit adminpanel.users_path
15
+ end
16
+
17
+ it { should have_link(I18n.t("user.new"), adminpanel.new_user_path)}
18
+ it { should have_link("i", adminpanel.user_path(user)) }
19
+ it { should have_link("i", adminpanel.edit_user_path(user)) }
20
+ end
21
+
22
+ describe "new" do
23
+ let(:category) { Factory(:category) }
24
+ before do
25
+ visit adminpanel.new_user_path
26
+ end
27
+
28
+ it { should have_title(I18n.t("user.new")) }
29
+
30
+ describe "with invalid information" do
31
+ before { find("form#new_user").submit_form! }
32
+
33
+ it { should have_title(I18n.t("user.new")) }
34
+ it { should have_selector("div#alerts") }
35
+ end
36
+
37
+ describe "with valid information" do
38
+ before do
39
+ fill_in "user_name", :with => "user_name"
40
+ fill_in "user_email", :with => "user@example.com"
41
+ fill_in "user_password", :with => "123456"
42
+ fill_in "user_password_confirmation", :with => "123456"
43
+ find("form#new_user").submit_form!
44
+ end
45
+
46
+ it { should have_content(I18n.t("user.success"))}
47
+ end
48
+ end
49
+ end
@@ -4,7 +4,6 @@ describe Adminpanel::Section do
4
4
  before do
5
5
  @section = Adminpanel::Section.new(
6
6
  :description => "Test description for product",
7
- :file => "example.png",
8
7
  :has_image => true,
9
8
  :key => "example_key",
10
9
  :has_description => true
@@ -14,7 +13,6 @@ describe Adminpanel::Section do
14
13
  subject { @section }
15
14
 
16
15
  it { should respond_to(:description) }
17
- it { should respond_to(:file) }
18
16
  it { should respond_to(:has_image) }
19
17
  it { should respond_to(:key) }
20
18
  it { should respond_to(:name) }
@@ -1,3 +1,5 @@
1
+ include ActionDispatch::TestProcess
2
+
1
3
  Factory.define :user, :class => Adminpanel::User do |user|
2
4
  user.name "test user"
3
5
  user.email "email@test.com"
@@ -14,4 +16,21 @@ Factory.define :product, :class => Adminpanel::Product do |product|
14
16
  product.brief "very little description"
15
17
  product.description "this is a little longer description, can be very long"
16
18
  product.association :category, :factory => :category
19
+ end
20
+
21
+ Factory.define :gallery, :class => Adminpanel::Gallery do |gallery|
22
+ gallery.file { fixture_file_upload(Rails.root.join('app', 'assets', 'images', 'hipster.jpg'), 'image/jpeg') }
23
+ end
24
+
25
+ Factory.define :image_section, :class => Adminpanel::Image do |image|
26
+ image.model "Section"
27
+ image.file { fixture_file_upload(Rails.root.join('app', 'assets', 'images', 'hipster.jpg'), 'image/jpeg') }
28
+ end
29
+
30
+ Factory.define :section_with_gallery, :class => Adminpanel::Section do |section|
31
+ section.key "key"
32
+ # section.description "<p>description</p>"
33
+ section.has_image true
34
+ section.has_description false
35
+ section.name "section_name"
17
36
  end
@@ -8,4 +8,20 @@ RSpec::Matchers::define :have_title do |text|
8
8
  match do |page|
9
9
  Capybara.string(page.body).has_selector?('title', :text => text)
10
10
  end
11
+ end
12
+
13
+ def clean_uploads_folder
14
+ FileUtils.rm_rf(Dir["#{Rails.root}/public/uploads/."])
15
+ end
16
+
17
+ RSpec::Matchers.define(:have_image) do |src|
18
+ match { |node| node.has_selector? %(img[src="#{src}"]) }
19
+
20
+ failure_message_for_should do
21
+ "Expected an image with src #{src.inspect}"
22
+ end
23
+
24
+ failure_message_for_should_not do
25
+ "Found image with src #{src.inspect}!"
26
+ end
11
27
  end
@@ -56,7 +56,6 @@ ActiveRecord::Schema.define(:version => 20131120070259) do
56
56
  t.text "description"
57
57
  t.string "key"
58
58
  t.boolean "has_image"
59
- t.string "file"
60
59
  t.datetime "created_at", :null => false
61
60
  t.datetime "updated_at", :null => false
62
61
  t.boolean "has_description"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adminpanel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0cl
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Ramon Camacho
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2013-12-05 00:00:00 Z
13
+ date: 2013-12-11 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -260,6 +260,7 @@ files:
260
260
  - app/assets/stylesheets/application-admin.css
261
261
  - app/controllers/adminpanel/application_controller.rb
262
262
  - app/controllers/adminpanel/categories_controller.rb
263
+ - app/controllers/adminpanel/clients_controller.rb
263
264
  - app/controllers/adminpanel/galleries_controller.rb
264
265
  - app/controllers/adminpanel/products_controller.rb
265
266
  - app/controllers/adminpanel/sections_controller.rb
@@ -270,19 +271,25 @@ files:
270
271
  - app/helpers/adminpanel/sessions_helper.rb
271
272
  - app/helpers/custom_form_builder.rb
272
273
  - app/models/adminpanel/category.rb
274
+ - app/models/adminpanel/client.rb
273
275
  - app/models/adminpanel/gallery.rb
274
276
  - app/models/adminpanel/image.rb
275
277
  - app/models/adminpanel/product.rb
276
278
  - app/models/adminpanel/section.rb
277
279
  - app/models/adminpanel/user.rb
280
+ - app/uploaders/adminpanel/client_uploader.rb
278
281
  - app/uploaders/adminpanel/gallery_uploader.rb
279
282
  - app/uploaders/adminpanel/image_uploader.rb
280
- - app/uploaders/adminpanel/section_uploader.rb
281
283
  - app/views/adminpanel/.DS_Store
282
284
  - app/views/adminpanel/categories/edit.html.erb
283
285
  - app/views/adminpanel/categories/index.html.erb
284
286
  - app/views/adminpanel/categories/new.html.erb
285
287
  - app/views/adminpanel/categories/show.html.erb
288
+ - app/views/adminpanel/clients/_client_form.html.erb
289
+ - app/views/adminpanel/clients/edit.html.erb
290
+ - app/views/adminpanel/clients/index.html.erb
291
+ - app/views/adminpanel/clients/new.html.erb
292
+ - app/views/adminpanel/clients/show.html.erb
286
293
  - app/views/adminpanel/galleries/create.html.erb
287
294
  - app/views/adminpanel/galleries/delete.html.erb
288
295
  - app/views/adminpanel/galleries/edit.html.erb
@@ -363,10 +370,15 @@ files:
363
370
  - spec/dummy/public/422.html
364
371
  - spec/dummy/public/500.html
365
372
  - spec/dummy/public/favicon.ico
373
+ - spec/dummy/public/uploads/gallery/file/1/hipster.jpg
374
+ - spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg
366
375
  - spec/dummy/script/rails
367
376
  - spec/features/authentication_pages_spec.rb
368
377
  - spec/features/categories_pages_spec.rb
378
+ - spec/features/galleries_pages_spec.rb
369
379
  - spec/features/product_pages_spec.rb
380
+ - spec/features/section_pages_spec.rb
381
+ - spec/features/user_pages_spec.rb
370
382
  - spec/models/category_spec.rb
371
383
  - spec/models/gallery_spec.rb
372
384
  - spec/models/product_spec.rb
@@ -380,7 +392,6 @@ files:
380
392
  - spec/support/submit_forms_without_button.rb
381
393
  - spec/uploaders/gallery_uploader_spec.rb
382
394
  - spec/uploaders/image_uploader_spec.rb
383
- - spec/uploaders/section_uploader_spec.rb
384
395
  homepage: https://github.com/joseramonc/adminpanel
385
396
  licenses:
386
397
  - MIT
@@ -397,7 +408,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
397
408
  - *id012
398
409
  required_rubygems_version: !ruby/object:Gem::Requirement
399
410
  requirements:
400
- - *id012
411
+ - - ">"
412
+ - !ruby/object:Gem::Version
413
+ version: 1.3.1
401
414
  requirements: []
402
415
 
403
416
  rubyforge_project:
@@ -442,10 +455,15 @@ test_files:
442
455
  - spec/dummy/public/422.html
443
456
  - spec/dummy/public/500.html
444
457
  - spec/dummy/public/favicon.ico
458
+ - spec/dummy/public/uploads/gallery/file/1/hipster.jpg
459
+ - spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg
445
460
  - spec/dummy/script/rails
446
461
  - spec/features/authentication_pages_spec.rb
447
462
  - spec/features/categories_pages_spec.rb
463
+ - spec/features/galleries_pages_spec.rb
448
464
  - spec/features/product_pages_spec.rb
465
+ - spec/features/section_pages_spec.rb
466
+ - spec/features/user_pages_spec.rb
449
467
  - spec/models/category_spec.rb
450
468
  - spec/models/gallery_spec.rb
451
469
  - spec/models/product_spec.rb
@@ -459,4 +477,3 @@ test_files:
459
477
  - spec/support/submit_forms_without_button.rb
460
478
  - spec/uploaders/gallery_uploader_spec.rb
461
479
  - spec/uploaders/image_uploader_spec.rb
462
- - spec/uploaders/section_uploader_spec.rb
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
- require 'support/active_record'
3
- require 'carrierwave/test/matchers'
4
-
5
- describe Adminpanel::SectionUploader do
6
- include CarrierWave::Test::Matchers
7
-
8
- before do
9
- Adminpanel::SectionUploader.enable_processing = true
10
- @section = Adminpanel::Section.new(
11
- :file => "test.jpg",
12
- :description => nil,
13
- :has_image => true,
14
- :key => "section_key",
15
- :name => "identifier name",
16
- :has_description => false
17
- )
18
- @section_uploader = Adminpanel::SectionUploader.new(@section, :file)
19
- @section_uploader.store!(File.open(Rails.root + "app/assets/images/test.jpg"))
20
- end
21
-
22
- after do
23
- Adminpanel::SectionUploader.enable_processing = false
24
- @section_uploader.remove!
25
- end
26
-
27
- context 'the section.thumb version' do
28
- it "should scale down a landscape image to be exactly 460 by 355 pixels" do
29
- @section_uploader.thumb.should be_no_larger_than(460, 355)
30
- end
31
- end\
32
- end