adminpanel 0.1.1 → 1.0.0
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.
- data/.rspec +2 -2
- data/.ruby-version +1 -0
- data/.travis.yml +8 -8
- data/Gemfile +26 -24
- data/README.md +57 -57
- data/adminpanel.gemspec +41 -39
- data/app/assets/fonts/fontawesome-webfont.svg +254 -254
- data/app/assets/javascripts/adminpanel/bootstrap-datepicker.js +1159 -1159
- data/app/assets/javascripts/adminpanel/bootstrap-timepicker.js +803 -803
- data/app/assets/javascripts/adminpanel/bootstrap.js +2170 -2170
- data/app/assets/javascripts/adminpanel/{products.js → images_form.js} +13 -13
- data/app/assets/javascripts/adminpanel/imagesloaded.js +12 -12
- data/app/assets/javascripts/adminpanel/jquery.dataTables.min.js +155 -155
- data/app/assets/javascripts/adminpanel/jquery.facybox.js +395 -395
- data/app/assets/javascripts/adminpanel/jquery.masonry.min.js +9 -9
- data/app/assets/javascripts/adminpanel/jquery.slimscroll.min.js +13 -13
- data/app/assets/javascripts/adminpanel/medium-editor.js +702 -702
- data/app/assets/javascripts/adminpanel/realm.js +87 -87
- data/app/assets/javascripts/adminpanel/tables.js +126 -126
- data/app/assets/javascripts/application-admin.js +15 -15
- data/app/assets/stylesheets/adminpanel/_clearfix.css.scss +7 -7
- data/app/assets/stylesheets/adminpanel/alertify.css +241 -241
- data/app/assets/stylesheets/adminpanel/bootstrap.css +6103 -6103
- data/app/assets/stylesheets/adminpanel/colorpicker.css +6 -6
- data/app/assets/stylesheets/adminpanel/datepicker.css +9 -9
- data/app/assets/stylesheets/adminpanel/elfinder.min.css +59 -59
- data/app/assets/stylesheets/adminpanel/facybox.css +146 -146
- data/app/assets/stylesheets/adminpanel/font-awesome.min.css +33 -33
- data/app/assets/stylesheets/adminpanel/fullcalendar.css +618 -618
- data/app/assets/stylesheets/adminpanel/fullcalendar.print.css +61 -61
- data/app/assets/stylesheets/adminpanel/select2.css +524 -524
- data/app/assets/stylesheets/adminpanel/theme.css +1571 -1571
- data/app/assets/stylesheets/adminpanel/timepicker.css +82 -82
- data/app/assets/stylesheets/application-admin.css +13 -13
- data/app/controllers/adminpanel/application_controller.rb +32 -17
- data/app/controllers/adminpanel/galleries_controller.rb +80 -80
- data/app/controllers/adminpanel/sections_controller.rb +45 -45
- data/app/controllers/adminpanel/sessions_controller.rb +26 -26
- data/app/controllers/adminpanel/users_controller.rb +84 -84
- data/app/helpers/adminpanel/application_helper.rb +41 -51
- data/app/helpers/adminpanel/breadcrumbs_helper.rb +16 -0
- data/app/helpers/adminpanel/custom_form_builder.rb +248 -0
- data/app/helpers/adminpanel/images_helper.rb +9 -9
- data/app/helpers/adminpanel/rest_actions_helper.rb +47 -0
- data/app/helpers/adminpanel/router_helper.rb +33 -0
- data/app/helpers/adminpanel/sessions_helper.rb +25 -25
- data/app/models/adminpanel/gallery.rb +60 -60
- data/app/models/adminpanel/image.rb +14 -14
- data/app/models/adminpanel/section.rb +22 -22
- data/app/models/adminpanel/user.rb +35 -35
- data/app/uploaders/adminpanel/gallery_uploader.rb +55 -55
- data/app/uploaders/adminpanel/image_uploader.rb +57 -57
- data/app/views/adminpanel/galleries/_galleries_table.html.erb +14 -14
- data/app/views/adminpanel/galleries/create.html.erb +2 -2
- data/app/views/adminpanel/galleries/delete.html.erb +2 -2
- data/app/views/adminpanel/galleries/edit.html.erb +25 -25
- data/app/views/adminpanel/galleries/index.html.erb +51 -51
- data/app/views/adminpanel/galleries/new.html.erb +17 -17
- data/app/views/adminpanel/galleries/show.html.erb +17 -17
- data/app/views/adminpanel/galleries/update.html.erb +2 -2
- data/app/views/adminpanel/sections/_image_fields.html.erb +23 -23
- data/app/views/adminpanel/sections/_sections_table.html.erb +16 -16
- data/app/views/adminpanel/sections/create.html.erb +2 -2
- data/app/views/adminpanel/sections/destroy.html.erb +2 -2
- data/app/views/adminpanel/sections/edit.html.erb +41 -41
- data/app/views/adminpanel/sections/index.html.erb +44 -44
- data/app/views/adminpanel/sections/new.html.erb +26 -26
- data/app/views/adminpanel/sections/show.html.erb +30 -30
- data/app/views/adminpanel/sections/update.html.erb +2 -2
- data/app/views/adminpanel/sessions/new.html.erb +25 -25
- data/app/views/adminpanel/users/_user_form.html.erb +20 -20
- data/app/views/adminpanel/users/edit.html.erb +5 -5
- data/app/views/adminpanel/users/index.html.erb +49 -49
- data/app/views/adminpanel/users/new.html.erb +5 -5
- data/app/views/adminpanel/users/show.html.erb +20 -20
- data/app/views/layouts/_shim.html.erb +3 -3
- data/app/views/layouts/_side_menu.html.erb +49 -43
- data/app/views/layouts/_top_bar.html.erb +43 -43
- data/app/views/layouts/admin-login.html.erb +28 -28
- data/app/views/layouts/admin.html.erb +41 -39
- data/app/views/shared/_breadcrumb.html.erb +6 -6
- data/app/views/shared/_error_messages.html.erb +16 -16
- data/app/views/shared/_form_fields.html.erb +25 -0
- data/app/views/{adminpanel/products → shared}/_image_fields.html.erb +23 -23
- data/app/views/shared/_init_editor.html.erb +24 -0
- data/app/views/shared/edit.html.erb +28 -0
- data/app/views/shared/index.html.erb +94 -0
- data/app/views/shared/new.html.erb +28 -0
- data/app/views/shared/show.html.erb +63 -0
- data/config/locales/en.yml +5 -5
- data/config/locales/es.yml +127 -129
- data/config/routes.rb +24 -16
- data/lib/adminpanel.rb +9 -7
- data/lib/adminpanel/active_record_extension.rb +38 -0
- data/lib/adminpanel/engine.rb +5 -5
- data/lib/adminpanel/version.rb +3 -3
- data/lib/generators/adminpanel/initialize/initialize_generator.rb +17 -0
- data/lib/generators/adminpanel/{install/templates/migrations → initialize/templates}/create_adminpanel_tables.rb +45 -64
- data/lib/generators/adminpanel/resource/resource_generator.rb +105 -0
- data/lib/generators/adminpanel/resource/templates/controller.rb +4 -0
- data/lib/generators/adminpanel/resource/templates/migration.rb +9 -0
- data/lib/generators/adminpanel/resource/templates/resource.rb +19 -0
- data/spec/dummy/.gitignore +17 -17
- data/spec/dummy/README.rdoc +261 -261
- data/spec/dummy/Rakefile +7 -7
- data/{app/views/adminpanel/categories/show.html.erb → spec/dummy/app/adminpanel/products.rb} +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -13
- data/spec/dummy/app/assets/stylesheets/application.css +13 -13
- data/spec/dummy/app/controllers/adminpanel/.gitkeep +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -11
- data/spec/dummy/app/helpers/application_helper.rb +2 -2
- data/spec/dummy/app/views/layouts/application.html.erb +14 -14
- data/spec/dummy/config.ru +4 -4
- data/spec/dummy/config/application.rb +62 -62
- data/spec/dummy/config/boot.rb +9 -9
- data/spec/dummy/config/carrierwve.rb +5 -5
- data/spec/dummy/config/database.yml +24 -24
- data/spec/dummy/config/environment.rb +5 -5
- data/spec/dummy/config/environments/development.rb +41 -41
- data/spec/dummy/config/environments/production.rb +72 -72
- data/spec/dummy/config/environments/test.rb +41 -41
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/spec/dummy/config/initializers/inflections.rb +15 -15
- data/spec/dummy/config/initializers/mime_types.rb +5 -5
- data/spec/dummy/config/initializers/secret_token.rb +8 -8
- data/spec/dummy/config/initializers/session_store.rb +8 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/spec/dummy/config/locales/en.yml +5 -5
- data/spec/dummy/config/routes.rb +4 -4
- data/spec/dummy/db/schema.rb +15 -15
- data/spec/dummy/public/404.html +26 -26
- data/spec/dummy/public/422.html +26 -26
- data/spec/dummy/public/500.html +25 -25
- data/spec/dummy/public/uploads/gallery/file/1/hipster.jpg +0 -0
- data/spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg +0 -0
- data/spec/dummy/script/rails +6 -6
- data/spec/features/authentication_pages_spec.rb +43 -43
- data/spec/features/galleries_pages_spec.rb +124 -124
- data/spec/features/section_pages_spec.rb +37 -37
- data/spec/features/user_pages_spec.rb +48 -48
- data/spec/generators/initialize_spec.rb +9 -0
- data/spec/generators/resource_spec.rb +122 -0
- data/spec/models/gallery_spec.rb +21 -21
- data/spec/models/section_spec.rb +66 -66
- data/spec/models/user_spec.rb +105 -105
- data/spec/spec_helper.rb +32 -31
- data/spec/support/define_factory_models.rb +25 -36
- data/spec/support/helper_methods.rb +26 -26
- data/spec/support/submit_forms_without_button.rb +16 -16
- data/spec/support/test_database.rb +45 -58
- data/spec/uploaders/gallery_uploader_spec.rb +36 -30
- data/spec/uploaders/image_uploader_spec.rb +30 -29
- metadata +208 -64
- checksums.yaml +0 -7
- data/app/assets/javascripts/adminpanel/init_editor.js +0 -28
- data/app/controllers/adminpanel/categories_controller.rb +0 -41
- data/app/controllers/adminpanel/products_controller.rb +0 -88
- data/app/helpers/custom_form_builder.rb +0 -219
- data/app/models/adminpanel/category.rb +0 -7
- data/app/models/adminpanel/product.rb +0 -24
- data/app/views/adminpanel/categories/edit.html.erb +0 -18
- data/app/views/adminpanel/categories/index.html.erb +0 -55
- data/app/views/adminpanel/categories/new.html.erb +0 -18
- data/app/views/adminpanel/products/.DS_Store +0 -0
- data/app/views/adminpanel/products/_product_form.html.erb +0 -31
- data/app/views/adminpanel/products/edit.html.erb +0 -10
- data/app/views/adminpanel/products/index.html.erb +0 -51
- data/app/views/adminpanel/products/new.html.erb +0 -10
- data/app/views/adminpanel/products/show.html.erb +0 -61
- data/config/database.yml +0 -24
- data/lib/generators/adminpanel/install/install_generator.rb +0 -12
- data/spec/features/categories_pages_spec.rb +0 -44
- data/spec/features/product_pages_spec.rb +0 -64
- data/spec/models/category_spec.rb +0 -58
- data/spec/models/product_spec.rb +0 -51
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<% provide(:page_title, t("category.new")) %>
|
|
2
|
-
<% breadcrumb_add('Categorias', products_path) %>
|
|
3
|
-
<div class="row-fluid">
|
|
4
|
-
<div class = "widget widget-padding span12">
|
|
5
|
-
<div class = "widget-header"><i class = "icon-truck"></i><h5>Categoría</h5></div>
|
|
6
|
-
<div class = "widget-body">
|
|
7
|
-
<div class = "widget-forms clearfix">
|
|
8
|
-
<%= custom_form_for(@category, :url => categories_path, :html => {:class => "form-horizontal"}) do |f| %>
|
|
9
|
-
<%= render 'shared/error_messages', :object => @category %>
|
|
10
|
-
<%= f.text_field :name, :label => "Nombre", :placeholder => "Nombre de la categoria" %>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
<div class = "widget-footer">
|
|
14
|
-
<%= f.submit "Agregar", :disable_with => 'Submiting...', :id =>"new-category-button" %>
|
|
15
|
-
</div>
|
|
16
|
-
<% end -%>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
Binary file
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<div class = "widget-body">
|
|
2
|
-
<div class = "widget-forms clearfix">
|
|
3
|
-
<%= custom_form_for(@product, {:class => "form-horizontal"}) do |f| %>
|
|
4
|
-
<%= render 'shared/error_messages', :object => @product %>
|
|
5
|
-
<%= f.text_field :name, :label => t("model.attributes.Adminpanel::Product.name"), :placeholder => t("model.attributes.Adminpanel::Product.name") %>
|
|
6
|
-
<%= f.text_field :brief, :label => t("model.attributes.Adminpanel::Product.brief"), :placeholder => t("model.attributes.Adminpanel::Product.brief") %>
|
|
7
|
-
|
|
8
|
-
<div class="control-group">
|
|
9
|
-
<label class="control-label"><%= t("Description") %></label>
|
|
10
|
-
<div class="controls">
|
|
11
|
-
<%= f.hidden_field :description, :id => "description-field" %>
|
|
12
|
-
<% if @product.description.nil? %>
|
|
13
|
-
<%= content_tag(:div, @product.description, :class => "editable", "data-placeholder" => t("Write description here")) %>
|
|
14
|
-
<% else %>
|
|
15
|
-
<%= content_tag(:div, @product.description.html_safe, :class => "editable controls", "data-placeholder" => t("Write description here")) %>
|
|
16
|
-
<% end %>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
<%= f.select :category_id, @categories, :label => t("model.Category") %>
|
|
20
|
-
|
|
21
|
-
<%= f.fields_for :images do |builder| %>
|
|
22
|
-
<%= render 'image_fields', :f => builder, :model_name => @product.simple_name %>
|
|
23
|
-
<% end -%>
|
|
24
|
-
|
|
25
|
-
<%= link_to_add_fields t("Add Image"), f, :images, @product.simple_name %>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
<div class = "widget-footer">
|
|
29
|
-
<%= f.submit t("action.save"), :disable_with => 'Submiting...', :id => "save-button" %>
|
|
30
|
-
</div>
|
|
31
|
-
<% end -%>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<% provide(:page_title, t("action.edit")) %>
|
|
2
|
-
<% breadcrumb_add(t("model.Products"), products_path) %>
|
|
3
|
-
<% breadcrumb_add(@product.name, product_path(@product)) %>
|
|
4
|
-
<div class="row-fluid">
|
|
5
|
-
<div class = "widget widget-padding span12">
|
|
6
|
-
<div class = "widget-header"><i class = "icon-truck"></i><h5><%= t("model.Product") %></h5></div>
|
|
7
|
-
|
|
8
|
-
<%= render 'product_form' %>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<%= provide(:page_title, "Productos") %>
|
|
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("product.new"), nil),
|
|
7
|
-
:class => "btn btn-box span2"),
|
|
8
|
-
new_product_path
|
|
9
|
-
)
|
|
10
|
-
%>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<div class="row-fluid">
|
|
14
|
-
<div class="widget widget-padding span12">
|
|
15
|
-
<div class="widget-header">
|
|
16
|
-
<i class="icon-truck"></i>
|
|
17
|
-
<h5>Productos</h5>
|
|
18
|
-
</div>
|
|
19
|
-
<div class="widget-body">
|
|
20
|
-
<div class="dataTables_wrapper form-inline">
|
|
21
|
-
<table id="information-table" class="table table-striped table-bordered dataTable">
|
|
22
|
-
<thead>
|
|
23
|
-
<tr>
|
|
24
|
-
<th>Nombre</th>
|
|
25
|
-
<th>Descripción</th>
|
|
26
|
-
<th>Acción</th>
|
|
27
|
-
</tr>
|
|
28
|
-
</thead>
|
|
29
|
-
<tbody>
|
|
30
|
-
<% @products.each do |product| %>
|
|
31
|
-
<tr>
|
|
32
|
-
<td><%= link_to product.name, product_path(product) %></td>
|
|
33
|
-
<td><%= strip_tags product.description %></td>
|
|
34
|
-
<td>
|
|
35
|
-
<%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_product_path(product), :title => "Editar"%>
|
|
36
|
-
<%= link_to content_tag(:i, nil, :class => 'icon-remove'), product_path(product), :title => "Borrar", :method => :delete,
|
|
37
|
-
:data => { :confirm => "Seguro?" }
|
|
38
|
-
%>
|
|
39
|
-
</td>
|
|
40
|
-
</tr>
|
|
41
|
-
<% end %>
|
|
42
|
-
</tbody>
|
|
43
|
-
</table>
|
|
44
|
-
<div class="row-fluid">
|
|
45
|
-
<div class="span6"></div>
|
|
46
|
-
<div class="span6"></div>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<% provide(:page_title, t("product.new")) %>
|
|
2
|
-
<% breadcrumb_add(t("model.Products"), products_path) %>
|
|
3
|
-
<div class="row-fluid">
|
|
4
|
-
<div class = "widget widget-padding span12">
|
|
5
|
-
<div class = "widget-header"><i class = "icon-truck"></i><h5><%= t("model.Product") %></h5></div>
|
|
6
|
-
|
|
7
|
-
<%= render 'product_form' %>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<% provide(:page_title, @product.name.humanize) %>
|
|
2
|
-
<% breadcrumb_add('Productos', products_path) %>
|
|
3
|
-
|
|
4
|
-
<div class="row-fluid">
|
|
5
|
-
<div class="widget span6">
|
|
6
|
-
<div class="widget-header">
|
|
7
|
-
<i class="icon-truck"></i>
|
|
8
|
-
<h5><%= @product.name.humanize %>
|
|
9
|
-
<%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_product_path(@product), :title => "Editar Producto" %>
|
|
10
|
-
</h5>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="widget-body">
|
|
13
|
-
<div class="widget-tickets widget-tickets-large clearfix"><ul>
|
|
14
|
-
<li class="priority-high">
|
|
15
|
-
<div class="span3">
|
|
16
|
-
<h6>Breve Descripción:</h6>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="span8">
|
|
19
|
-
<%= @product.brief %>
|
|
20
|
-
</div>
|
|
21
|
-
</li>
|
|
22
|
-
|
|
23
|
-
<li class="priority-high">
|
|
24
|
-
<div class="span3">
|
|
25
|
-
<h6>Descripción:</h6>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="span8">
|
|
28
|
-
<%= @product.description.html_safe %>
|
|
29
|
-
</div>
|
|
30
|
-
</li>
|
|
31
|
-
|
|
32
|
-
<li class="priority-high">
|
|
33
|
-
<div class="span3">
|
|
34
|
-
<h6>Categoría</h6>
|
|
35
|
-
</div>
|
|
36
|
-
<div class="span8">
|
|
37
|
-
<%= @product.category.name %>
|
|
38
|
-
</div>
|
|
39
|
-
</li>
|
|
40
|
-
</ul></div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
<div id="product-content" class="widget widget-padding span6">
|
|
44
|
-
<div class="widget-header">
|
|
45
|
-
<i class="icon-truck"></i>
|
|
46
|
-
<h5>Galería: <%= @product.name.humanize %>
|
|
47
|
-
<%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_product_path(@product), :title => "Editar Producto" %>
|
|
48
|
-
</h5>
|
|
49
|
-
</div>
|
|
50
|
-
<div class="widget-body row-fluid">
|
|
51
|
-
<div id="gallery-container" class="js-masonry"
|
|
52
|
-
data-masonry-options='{ "columnWidth": 3, "itemSelector": ".gallery-item" }'>
|
|
53
|
-
<% @product.images.each do |image|%>
|
|
54
|
-
<div class="gallery-item">
|
|
55
|
-
<%= link_to (image_tag image.file_url(:thumb)), image.file.to_s, :rel => "group", :name => @product.name %>
|
|
56
|
-
</div>
|
|
57
|
-
<% end %>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
data/config/database.yml
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# SQLite version 3.x
|
|
2
|
-
# gem install sqlite3
|
|
3
|
-
#
|
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
5
|
-
# gem 'sqlite3'
|
|
6
|
-
development:
|
|
7
|
-
adapter: sqlite3
|
|
8
|
-
database: db/development.sqlite3
|
|
9
|
-
pool: 5
|
|
10
|
-
timeout: 5000
|
|
11
|
-
|
|
12
|
-
# Warning: The database defined as "test" will be erased and
|
|
13
|
-
# re-generated from your development database when you run "rake".
|
|
14
|
-
# Do not set this db to the same as development or production.
|
|
15
|
-
test:
|
|
16
|
-
adapter: sqlite3
|
|
17
|
-
database: ":memory:"
|
|
18
|
-
timeout: 500
|
|
19
|
-
|
|
20
|
-
production:
|
|
21
|
-
adapter: sqlite3
|
|
22
|
-
database: db/production.sqlite3
|
|
23
|
-
pool: 5
|
|
24
|
-
timeout: 5000
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
require "rails/generators/active_record"
|
|
2
|
-
module Adminpanel
|
|
3
|
-
module Generators
|
|
4
|
-
class InstallGenerator < ActiveRecord::Generators::Base
|
|
5
|
-
source_root File.expand_path("../templates", __FILE__)
|
|
6
|
-
|
|
7
|
-
def create_migrations
|
|
8
|
-
migration_template 'migrations/create_adminpanel_tables.rb', 'db/migrate/create_adminpanel_tables.rb'
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe "Categories 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(:category) { Factory(:category) }
|
|
14
|
-
before do
|
|
15
|
-
visit adminpanel.categories_path
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it { should have_link(I18n.t("category.new"), adminpanel.new_category_path)}
|
|
19
|
-
it { should have_link("i", adminpanel.category_path(category)) }
|
|
20
|
-
it { should have_link("i", adminpanel.edit_category_path(category)) }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe "new" do
|
|
24
|
-
before { visit adminpanel.new_category_path }
|
|
25
|
-
|
|
26
|
-
it { should have_title(I18n.t("category.new")) }
|
|
27
|
-
|
|
28
|
-
describe "with invalid information" do
|
|
29
|
-
before { find("form#new_category").submit_form! }
|
|
30
|
-
|
|
31
|
-
it { should have_title(I18n.t("category.new")) }
|
|
32
|
-
it { should have_selector("div#alerts") }
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe "with valid information" do
|
|
36
|
-
before do
|
|
37
|
-
fill_in "category_name", :with => "category name"
|
|
38
|
-
find("form#new_category").submit_form!
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it { should have_content(I18n.t("category.success"))}
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe "Product 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(:product) { Factory(:product) }
|
|
14
|
-
before do
|
|
15
|
-
visit adminpanel.products_path
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it { should have_link(I18n.t("product.new"), adminpanel.new_product_path)}
|
|
19
|
-
it { should have_link("i", adminpanel.product_path(product)) }
|
|
20
|
-
it { should have_link("i", adminpanel.edit_product_path(product)) }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe "new" do
|
|
24
|
-
let(:category) { Factory(:category) }
|
|
25
|
-
before do
|
|
26
|
-
category.id = 1 #to force instantiation so it becomes available in the select
|
|
27
|
-
visit adminpanel.new_product_path
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it { should have_title(I18n.t("product.new")) }
|
|
31
|
-
|
|
32
|
-
describe "with invalid information" do
|
|
33
|
-
before { find("form#new_product").submit_form! }
|
|
34
|
-
|
|
35
|
-
it { should have_title(I18n.t("product.new")) }
|
|
36
|
-
it { should have_selector("div#alerts") }
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
describe "with valid information" do
|
|
40
|
-
before do
|
|
41
|
-
fill_in "product_name", :with => "product name"
|
|
42
|
-
fill_in "product_brief", :with => "little brief"
|
|
43
|
-
find(:xpath, "//input[@id='description-field']").set "a little longer text"
|
|
44
|
-
select category.name, :from => "product_category_id"
|
|
45
|
-
find("form#new_product").submit_form!
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it { should have_content(I18n.t("product.success"))}
|
|
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
|
|
58
|
-
|
|
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) }
|
|
63
|
-
end
|
|
64
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Adminpanel::Category do
|
|
4
|
-
before do
|
|
5
|
-
@category = Adminpanel::Category.new(
|
|
6
|
-
:name => "Test category"
|
|
7
|
-
)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
subject { @category}
|
|
11
|
-
|
|
12
|
-
it {should respond_to(:name) }
|
|
13
|
-
|
|
14
|
-
describe "when name is not present" do
|
|
15
|
-
before {@category.name = " "}
|
|
16
|
-
it {should_not be_valid}
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
data/spec/models/product_spec.rb
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Adminpanel::Product do
|
|
4
|
-
before do
|
|
5
|
-
@category = Adminpanel::Category.new(
|
|
6
|
-
:name => "test category",
|
|
7
|
-
:id => 1
|
|
8
|
-
)
|
|
9
|
-
@product = Adminpanel::Product.new(
|
|
10
|
-
:description => "Test description for product",
|
|
11
|
-
:name => "product name",
|
|
12
|
-
:category_id => "1",
|
|
13
|
-
:brief => "short description"
|
|
14
|
-
)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
subject { @product }
|
|
18
|
-
|
|
19
|
-
it { should respond_to(:name) }
|
|
20
|
-
it { should respond_to(:description) }
|
|
21
|
-
it { should respond_to(:category_id) }
|
|
22
|
-
it { should respond_to(:brief) }
|
|
23
|
-
|
|
24
|
-
describe "when product belongs to a category" do
|
|
25
|
-
before {@category.save}
|
|
26
|
-
after {@category.delete}
|
|
27
|
-
it {@product.category.should eql(@category)}
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe "when no name present" do
|
|
31
|
-
before {@product.name = " "}
|
|
32
|
-
it {should_not be_valid}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe "when no description present" do
|
|
36
|
-
before {@product.description = " "}
|
|
37
|
-
it {should_not be_valid}
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
describe "when no category is present" do
|
|
41
|
-
before {@product.category_id = " "}
|
|
42
|
-
it {should_not be_valid}
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
describe "when no brief is present" do
|
|
46
|
-
before {@product.brief = " "}
|
|
47
|
-
it {should_not be_valid}
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
end
|