fullstack-admin 0.1.10 → 0.1.11

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.10
1
+ 0.1.11
@@ -14,18 +14,10 @@ class Admin::Responder < ActionController::Responder
14
14
  l = options[:location] || default_location
15
15
  end
16
16
 
17
-
18
- # If it's not a get request and the object has no errors, set the flash message
19
- # according to the current action. If the controller is users/pictures, the
20
- # flash message lookup for create is:
21
- #
22
- # flash.users.pictures.create
23
- # flash.actions.create
24
- #
25
17
  def to_html
26
18
  unless get?
27
- default_success_message = delete? ? I18n.t("flash.success.delete") : I18n.t("flash.success.update")
28
- default_error_message = delete? ? I18n.t("flash.error.delete") : I18n.t("flash.error.update")
19
+ default_success_message = delete? ? I18n.t("fullstack.admin.flash.success.delete") : I18n.t("fullstack.admin.flash.success.update")
20
+ default_error_message = delete? ? I18n.t("fullstack.admin.flash.error.delete") : I18n.t("fullstack.admin.flash.error.update")
29
21
 
30
22
  if has_errors?
31
23
  controller.flash[:error] = options.delete(:error) || default_error_message
@@ -25,5 +25,9 @@ module ScaffoldHelper
25
25
  method = "#{method}"
26
26
  super(@search, method, I18n.t(method, :scope => 'fullstack.admin.form.labels', :default => method.humanize))
27
27
  end
28
+
29
+ def app_name
30
+ Rails.application.class.to_s.split("::").first.underscore.humanize
31
+ end
28
32
 
29
33
  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><%= t('fullstack.admin.edit', :default => "Edit") %> `<%= title_for(resource) %>`</h1></div>
5
+ <% end -%>
6
+
7
+ <%= render :partial => 'form' %>
8
+
@@ -0,0 +1,62 @@
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
+ <% if partial?('collection') %>
8
+ <%= render :partial => "collection", :locals => {:collection => instance_variable_get("@#{controller_name}"), :"#{controller_name}" => instance_variable_get("@#{controller_name}")} %>
9
+ <% else %>
10
+
11
+
12
+
13
+ <div class="mb1">
14
+ <% if subject.can_create?(controller_name) && controller.action_methods.include?("new") %>
15
+ <%= link_to send("new_admin_#{controller_name.singularize}_path"), :class => "btn btn-primary" do %>
16
+ <i class="icon icon-plus icon-white"></i> <%= _("New") %>
17
+ <% end -%>
18
+ <% end %>
19
+
20
+ <%= link_to 'javascript:void(0)', :class => "btn toggle-delete" do %>
21
+ <i class="icon icon-trash"></i> <%= _("Delete") %>
22
+ <% end -%>
23
+
24
+ </div>
25
+
26
+
27
+ <table class="table table-bordered table-striped index-table">
28
+ <thead>
29
+ <tr>
30
+ <%= render :partial => 'index', :locals => {:thead => true, :tbody => false, :content => nil} %>
31
+ </tr>
32
+ </thead>
33
+ <tbody>
34
+ <% instance_variable_get("@#{controller_name}").each do |item| -%>
35
+ <tr>
36
+ <%= render :partial => 'index', :locals => {:thead => false, :tbody => true, :content => item} %>
37
+ </tr>
38
+ <% end -%>
39
+ </tbody>
40
+ <%= paginate instance_variable_get("@#{controller_name}"), :window => 4, :outer_window => 3 %>
41
+
42
+ </table>
43
+
44
+ <% end %>
45
+
46
+ <% content_for :aside do -%>
47
+
48
+ <% if partial?('filter') %>
49
+ <div class="well">
50
+ <div class="mb1">
51
+ <h4>Filtra</h4>
52
+ </div>
53
+ <%= admin_form_for @search, :url => self.send("admin_#{collection_name}_path") , :html => {:method => :get} do |f| %>
54
+ <%= render :partial => "filter", :locals => {:f => f} %>
55
+ <%= f.buttons do %>
56
+ <%= f.commit_button _("Filter") %>
57
+ <% end %>
58
+ <% end %>
59
+ </div>
60
+ <% end %>
61
+ <% end -%>
62
+
@@ -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("fullstack.admin.flash.success.update") %>')
3
+ <% else %>
4
+ notify_error('<%=j t("fullstack.admin.flash.error.update") %>')
5
+ <% end %>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html lang="it">
3
+ <head>
4
+ <%= csrf_meta_tags %>
5
+ <title><%= ( @title ? "#{@title} - " : "" ) + "#{app_name} Admin" %></title>
6
+
7
+ <%= stylesheet_link_tag 'admin/admin' %>
8
+ <%= yield :stylesheets %>
9
+ </head>
10
+
11
+ <body>
12
+ <%= render :partial => 'admin/shared/nav' %>
13
+
14
+ <%= navbar :fixed => :top do %>
15
+ <%= brand "#{app_name} Admin", admin_root_path %>
16
+ <%= yield :menu %>
17
+ <% end %>
18
+
19
+ <%= yield :crumbs %>
20
+
21
+ <%= container :fluid, :class => "main" do %>
22
+ <%= row do %>
23
+
24
+ <%= span(2, :id => "left-aside") do %>
25
+ <%= yield :nav %>
26
+ <% end %>
27
+
28
+ <%= span(content_for?(:aside) ? 6 : 10, :id => "center") do %>
29
+ <%= yield %>
30
+ <% end %>
31
+
32
+ <% if content_for?(:aside) %>
33
+ <%= span(4, :id => "left-aside") do %>
34
+ <%= yield :nav %>
35
+ <% end %>
36
+ <% end %>
37
+
38
+ <% end %>
39
+ <% end %>
40
+
41
+ <%= javascript_include_tag 'admin/admin' %>
42
+ <%= yield :javascripts %>
43
+
44
+ <% [:notice, :error, :alert].each do |sym| %>
45
+
46
+ <% if flash[sym].present? %>
47
+ <%= javascript_tag do %>
48
+ $.notify.notice('<%= j "#{flash[sym]}" %>');
49
+ <% end %>
50
+
51
+ <% flash.discard(sym) %>
52
+ <% end %>
53
+
54
+ <% end %>
55
+
56
+ </body>
57
+ </html>
58
+
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ mount Ckeditor::Engine => '/ckeditor'
3
+ end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "fullstack-admin"
8
- s.version = "0.1.10"
8
+ s.version = "0.1.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mcasimir"]
@@ -975,17 +975,27 @@ Gem::Specification.new do |s|
975
975
  "app/models/roleable.rb",
976
976
  "app/models/suspendable.rb",
977
977
  "app/models/trackable.rb",
978
+ "app/views/admin/base/destroy.js.coffee",
979
+ "app/views/admin/base/edit.html.erb",
980
+ "app/views/admin/base/index.html.erb",
981
+ "app/views/admin/base/new.html.erb",
982
+ "app/views/admin/base/update.js.coffee",
983
+ "app/views/layouts/admin.html.erb",
984
+ "config/routes.rb",
978
985
  "fullstack-admin.gemspec",
979
986
  "lib/fullstack-admin.rb",
980
987
  "lib/fullstack/admin.rb",
981
988
  "lib/fullstack/admin/engine.rb",
982
989
  "lib/generators/fullstack/admin/install_generator.rb",
990
+ "lib/generators/fullstack/admin/locale_generator.rb",
983
991
  "lib/generators/fullstack/admin/templates/root/app/assets/javascripts/admin/admin.js.coffee",
984
992
  "lib/generators/fullstack/admin/templates/root/app/assets/stylesheets/admin/admin.css",
993
+ "lib/generators/fullstack/admin/templates/root/app/controllers/admin/dashboard_controller.rb",
985
994
  "lib/generators/fullstack/admin/templates/root/app/models/user.rb",
995
+ "lib/generators/fullstack/admin/templates/root/app/views/admin/dashboard/show.html.erb",
986
996
  "lib/generators/fullstack/admin/templates/root/lib/support/user_subject.rb",
987
997
  "locales/en.yml",
988
- "locales/it.yml",
998
+ "locales/fullstack.admin.it.yml",
989
999
  "vendor/assets/javascripts/ajax-chosen.js",
990
1000
  "vendor/assets/javascripts/angular.js",
991
1001
  "vendor/assets/javascripts/bootstrap.js",
@@ -29,7 +29,23 @@ eos
29
29
 
30
30
  end
31
31
  end
32
-
32
+
33
+ def append_routes
34
+ route do
35
+ <<-eos
36
+ namespace :admin do
37
+ root :to => "dashboard#show"
38
+ end
39
+
40
+ eos
41
+
42
+ end
43
+ end
44
+
45
+ def english_localizations
46
+ generate "fullstack:admin:locale en"
47
+ end
48
+
33
49
  protected
34
50
 
35
51
 
@@ -0,0 +1,12 @@
1
+ module Fullstack
2
+ module Admin
3
+ class LocaleGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('../../../../locales', __FILE__)
5
+
6
+ def install
7
+ copy_file "#{name}.yml", Rails.root.join("config", "locales", "fullstack.admin.#{name}.yml")
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ class Admin::DashboardController < Admin::BaseController
2
+ def show
3
+ end
4
+ end
data/locales/en.yml CHANGED
@@ -5,5 +5,19 @@ en:
5
5
  edit: "Edit"
6
6
  delete: "Delete"
7
7
  are_you_sure: "Are you sure?"
8
+
8
9
  form:
9
10
  correct_these_errors_and_retry: "Correct these errors and retry"
11
+
12
+ flash:
13
+ success:
14
+ generic: "Changes saved successfully"
15
+ update: "Document updated successfully"
16
+ delete: "Document deleted successfully"
17
+
18
+ error:
19
+ generic: "Changes not saved due to an error"
20
+ update: "Document not updated due to an error"
21
+ delete: "Document not deleted due to an error"
22
+
23
+
@@ -0,0 +1,20 @@
1
+ it:
2
+ fullstack:
3
+ admin:
4
+ show: "Visualizza"
5
+ edit: "Modifica"
6
+ delete: "Elimina"
7
+ are_you_sure: "Sei sicuro?"
8
+ form:
9
+ correct_these_errors_and_retry: "Correggi questi errori e riprova"
10
+
11
+ flash:
12
+ success:
13
+ generic: "Cambiamenti salvati con successo"
14
+ update: "Documento salvato con successo"
15
+ delete: "Document eliminato con successo"
16
+
17
+ error:
18
+ generic: "Cambiamenti non salvati a causa di un errore"
19
+ update: "Documento non salvato a causa di un errore"
20
+ delete: "Documento non eliminato a causa di un errore"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fullstack-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -1201,17 +1201,27 @@ files:
1201
1201
  - app/models/roleable.rb
1202
1202
  - app/models/suspendable.rb
1203
1203
  - app/models/trackable.rb
1204
+ - app/views/admin/base/destroy.js.coffee
1205
+ - app/views/admin/base/edit.html.erb
1206
+ - app/views/admin/base/index.html.erb
1207
+ - app/views/admin/base/new.html.erb
1208
+ - app/views/admin/base/update.js.coffee
1209
+ - app/views/layouts/admin.html.erb
1210
+ - config/routes.rb
1204
1211
  - fullstack-admin.gemspec
1205
1212
  - lib/fullstack-admin.rb
1206
1213
  - lib/fullstack/admin.rb
1207
1214
  - lib/fullstack/admin/engine.rb
1208
1215
  - lib/generators/fullstack/admin/install_generator.rb
1216
+ - lib/generators/fullstack/admin/locale_generator.rb
1209
1217
  - lib/generators/fullstack/admin/templates/root/app/assets/javascripts/admin/admin.js.coffee
1210
1218
  - lib/generators/fullstack/admin/templates/root/app/assets/stylesheets/admin/admin.css
1219
+ - lib/generators/fullstack/admin/templates/root/app/controllers/admin/dashboard_controller.rb
1211
1220
  - lib/generators/fullstack/admin/templates/root/app/models/user.rb
1221
+ - lib/generators/fullstack/admin/templates/root/app/views/admin/dashboard/show.html.erb
1212
1222
  - lib/generators/fullstack/admin/templates/root/lib/support/user_subject.rb
1213
1223
  - locales/en.yml
1214
- - locales/it.yml
1224
+ - locales/fullstack.admin.it.yml
1215
1225
  - vendor/assets/javascripts/ajax-chosen.js
1216
1226
  - vendor/assets/javascripts/angular.js
1217
1227
  - vendor/assets/javascripts/bootstrap.js
@@ -1248,7 +1258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1248
1258
  version: '0'
1249
1259
  segments:
1250
1260
  - 0
1251
- hash: -3259856112816837098
1261
+ hash: -1397487762689386514
1252
1262
  required_rubygems_version: !ruby/object:Gem::Requirement
1253
1263
  none: false
1254
1264
  requirements: