klastera 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.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/javascripts/klastera/application.js +13 -0
  6. data/app/assets/javascripts/klastera/clusters.js +2 -0
  7. data/app/assets/stylesheets/klastera/application.css +15 -0
  8. data/app/assets/stylesheets/klastera/clusters.css +4 -0
  9. data/app/assets/stylesheets/scaffold.css +56 -0
  10. data/app/controllers/klastera/application_controller.rb +33 -0
  11. data/app/controllers/klastera/clusters_controller.rb +66 -0
  12. data/app/helpers/klastera/application_helper.rb +40 -0
  13. data/app/helpers/klastera/clusters_helper.rb +4 -0
  14. data/app/models/klastera/cluster.rb +5 -0
  15. data/app/models/klastera/cluster_user.rb +5 -0
  16. data/app/models/klastera/concerns/cluster.rb +78 -0
  17. data/app/models/klastera/concerns/cluster_user.rb +20 -0
  18. data/app/models/klastera/concerns/organization.rb +46 -0
  19. data/app/models/klastera/concerns/transfer.rb +54 -0
  20. data/app/models/klastera/concerns/user.rb +62 -0
  21. data/app/models/klastera/transfer.rb +5 -0
  22. data/app/views/klastera/clusters/_filter.html.erb +0 -0
  23. data/app/views/klastera/clusters/_form.html.erb +22 -0
  24. data/app/views/klastera/clusters/_form_transfer.html.erb +34 -0
  25. data/app/views/klastera/clusters/_table.html.erb +35 -0
  26. data/app/views/klastera/clusters/create.js.erb +1 -0
  27. data/app/views/klastera/clusters/destroy.js.erb +6 -0
  28. data/app/views/klastera/clusters/edit.html.erb +10 -0
  29. data/app/views/klastera/clusters/index.html.erb +21 -0
  30. data/app/views/klastera/clusters/new.html.erb +10 -0
  31. data/app/views/klastera/clusters/transfer.html.erb +10 -0
  32. data/app/views/klastera/clusters/update.js.erb +1 -0
  33. data/app/views/layouts/klastera/_cluster_role.html.erb +26 -0
  34. data/app/views/layouts/klastera/_cluster_user_fields.html.erb +10 -0
  35. data/app/views/layouts/klastera/_nested_cluster_user.html.erb +20 -0
  36. data/app/views/layouts/klastera/_options.html.erb +38 -0
  37. data/config/locales/es.yml +78 -0
  38. data/config/routes.rb +7 -0
  39. data/db/migrate/20200324203929_create_klastera_clusters.rb +12 -0
  40. data/db/migrate/20200326111219_add_cluster_options_to_organizations.rb +20 -0
  41. data/db/migrate/20200330010551_create_klastera_cluster_users.rb +9 -0
  42. data/lib/klastera/engine.rb +5 -0
  43. data/lib/klastera/version.rb +3 -0
  44. data/lib/klastera.rb +5 -0
  45. data/lib/tasks/klastera_tasks.rake +4 -0
  46. data/test/controllers/klastera/clusters_controller_test.rb +52 -0
  47. data/test/dummy/README.rdoc +28 -0
  48. data/test/dummy/Rakefile +6 -0
  49. data/test/dummy/app/assets/javascripts/application.js +13 -0
  50. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  51. data/test/dummy/app/controllers/application_controller.rb +5 -0
  52. data/test/dummy/app/helpers/application_helper.rb +2 -0
  53. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  54. data/test/dummy/bin/bundle +3 -0
  55. data/test/dummy/bin/rails +4 -0
  56. data/test/dummy/bin/rake +4 -0
  57. data/test/dummy/bin/setup +29 -0
  58. data/test/dummy/config/application.rb +26 -0
  59. data/test/dummy/config/boot.rb +5 -0
  60. data/test/dummy/config/database.yml +1 -0
  61. data/test/dummy/config/environment.rb +5 -0
  62. data/test/dummy/config/environments/development.rb +41 -0
  63. data/test/dummy/config/environments/production.rb +79 -0
  64. data/test/dummy/config/environments/test.rb +42 -0
  65. data/test/dummy/config/initializers/assets.rb +11 -0
  66. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  67. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  68. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  69. data/test/dummy/config/initializers/inflections.rb +16 -0
  70. data/test/dummy/config/initializers/mime_types.rb +4 -0
  71. data/test/dummy/config/initializers/session_store.rb +3 -0
  72. data/test/dummy/config/initializers/to_time_preserves_timezone.rb +10 -0
  73. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  74. data/test/dummy/config/locales/en.yml +23 -0
  75. data/test/dummy/config/routes.rb +4 -0
  76. data/test/dummy/config/secrets.yml +22 -0
  77. data/test/dummy/config.ru +4 -0
  78. data/test/dummy/log/development.log +108 -0
  79. data/test/dummy/log/test.log +0 -0
  80. data/test/dummy/public/404.html +67 -0
  81. data/test/dummy/public/422.html +67 -0
  82. data/test/dummy/public/500.html +66 -0
  83. data/test/dummy/public/favicon.ico +0 -0
  84. data/test/dummy/tmp/pids/server.pid +1 -0
  85. data/test/fixtures/klastera/cluster_users.yml +9 -0
  86. data/test/fixtures/klastera/clusters.yml +11 -0
  87. data/test/integration/navigation_test.rb +8 -0
  88. data/test/klastera_test.rb +7 -0
  89. data/test/models/klastera/cluster_test.rb +9 -0
  90. data/test/models/klastera/cluster_user_test.rb +9 -0
  91. data/test/test_helper.rb +21 -0
  92. metadata +207 -0
@@ -0,0 +1,35 @@
1
+ <table class="table table-striped table-hover table-condensed table-bordered datatable">
2
+ <thead>
3
+ <tr>
4
+ <th class="text-center cluster-name"><%=t('klastera.cluster_color')%></th>
5
+ <th class="text-center cluster-name"><%=t('klastera.cluster_name')%></th>
6
+ <th class="text-center cluster-nid"><%=t('klastera.cluster_nid')%></th>
7
+ <th class="cogs-actions four-icons"><span class="fa fa-cogs"></span></th>
8
+ </tr>
9
+ </thead>
10
+ <tbody>
11
+ <% @clusters.each do |cluster| %>
12
+ <tr>
13
+ <td class="text-center cluster-color">
14
+ <i style='<%="color:#{cluster.color}" if cluster.color.present?%>' class="fa fa-square fa-2x<%=' colorless' if cluster.color.blank?%>" aria-hidden="true"></i>
15
+ <span class="hide"><%=cluster.id%></span>
16
+ </td>
17
+ <td class="text-center cluster-name"><%= cluster.name %></td>
18
+ <td class="text-center cluster-nid"><%= cluster.nid %></td>
19
+ <td class="cogs-actions four-icons">
20
+ <%= link_to edit_cluster_path(cluster), class:'btn btn-primary btn-xs', title: t('shared.actions.edit'), "data-toggle": "modal", "data-target": "#remote-modal-block" do %>
21
+ <span class="fa fa-pencil-square-o"></span>
22
+ <% end %>
23
+ <%= link_to transfer_cluster_path(cluster), class:'btn btn-danger btn-xs', title: t('shared.actions.archive'), "data-toggle": "modal", "data-target": "#remote-modal-block" do %>
24
+ <span class="fa fa-trash"></span>
25
+ <% end %>
26
+ </td>
27
+ </tr>
28
+ <% end %>
29
+ </tbody>
30
+ </table>
31
+ <style type="text/css">
32
+ .odd .colorless { color: #F9F9F9 }
33
+ .even .colorless { color: #FFF }
34
+ tr:hover .colorless { color: #F5F5F5 }
35
+ </style>
@@ -0,0 +1 @@
1
+ <%= render 'layouts/remote_form/common', title: t('klastera.clusters.new.title'), action: :create, id: :cluster, o: @cluster %>
@@ -0,0 +1,6 @@
1
+ <% if @transfer.errors.any? %>
2
+ <%= render 'layouts/remote_form/common', title: t('klastera.clusters.destroy.title', cluster_nid: @cluster.nid), action: :update, id: :cluster, o: @transfer, form_partial: 'form_transfer' %>
3
+ <% else %>
4
+ $('#cluster-remote-form').html("<%= j render 'layouts/remote_form/blank_modal', title: "Eliminado", o: nil, fa: :qrcode, type: :success, message: t('klastera.messages.record_action_successfully',a: t('klastera.actions.deleted').downcase)%>")
5
+ <%= render 'layouts/remote_form/common', action: :destroy, id: :cluster %>
6
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <%= render layout: 'layouts/remote_form/wrapper', locals: { title: t('.title', cluster_nid: @cluster.nid), id: :cluster, fa: :qrcode } do %>
2
+ <div class="pull-right">
3
+ <%= link_to clusters_path(@cluster), class: 'btn btn-primary btn-sm', title: t('shared.actions.show') do %>
4
+ <span class="fa fa-eye"></span>
5
+ <% end %>
6
+ <%= link_to clusters_path, class: 'btn btn-default btn-sm', title: t('shared.actions.back') do %>
7
+ <span class="fa fa-list"></span>
8
+ <% end %>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,21 @@
1
+ <div class="container" id="gb-content-wrapper">
2
+ <div class="page-header">
3
+ <div class="pull-right">
4
+ <%= link_to(new_cluster_path, class: 'btn btn-success btn-xs action-control', "data-toggle": "modal", "data-target": "#remote-modal-block", title: t('shared.actions.new')) do %>
5
+ <i class="fa fa-plus"></i>
6
+ <% end %>
7
+ </div>
8
+ <h1><span class="fa fa-qrcode"></span> <%= t '.title' %></h1>
9
+ </div>
10
+
11
+ <div id="cluster-filter-remote-form">
12
+ <%= render 'filter' %>
13
+ </div>
14
+
15
+ <div id="cluster-remote-table" class="datatable-without-search">
16
+ <%= render 'table' %>
17
+ </div>
18
+
19
+ </div>
20
+
21
+ <%= render 'layouts/remote_form/modal'%>
@@ -0,0 +1,10 @@
1
+ <%= render layout: 'layouts/remote_form/wrapper', locals: { title: t('.title'), id: :cluster, fa: :qrcode } do %>
2
+ <div class="pull-right">
3
+ <%= link_to clusters_path(@cluster), class: 'btn btn-primary btn-sm', title: t('shared.actions.show') do %>
4
+ <span class="fa fa-eye"></span>
5
+ <% end %>
6
+ <%= link_to clusters_path, class: 'btn btn-default btn-sm', title: t('shared.actions.back') do %>
7
+ <span class="fa fa-list"></span>
8
+ <% end %>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <%= render layout: 'layouts/remote_form/wrapper', locals: { title: t('.title', cluster_nid: @cluster.nid), id: :cluster, fa: :qrcode, form: 'form_transfer' } do %>
2
+ <div class="pull-right">
3
+ <%= link_to clusters_path(@cluster), class: 'btn btn-primary btn-sm', title: t('shared.actions.show') do %>
4
+ <span class="fa fa-eye"></span>
5
+ <% end %>
6
+ <%= link_to clusters_path, class: 'btn btn-default btn-sm', title: t('shared.actions.back') do %>
7
+ <span class="fa fa-list"></span>
8
+ <% end %>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render 'layouts/remote_form/common', title: t('klastera.clusters.edit.title', cluster_nid: @cluster.nid), action: :update, id: :cluster, o: @cluster %>
@@ -0,0 +1,26 @@
1
+ <% user_cluster_roles = user_cluster_roles.nil? ? User::CLUSTER_ROLES : user_cluster_roles %>
2
+ <% if @user.organization.is_in_cluster_mode? %>
3
+ <div class="form-group">
4
+ <%= f.label t('klastera.cluster_role') %>
5
+ <%= f.select :cluster_role, user_cluster_roles.map{|r|[t("klastera.roles.#{r}"),r]}, { include_blank: true }, { class: 'form-control' } %>
6
+ </div>
7
+
8
+ <script type="text/javascript">
9
+ $('[name="user[cluster_role]"]').change(function(){
10
+ if ( $(this).val() == "<%=User::CLUSTER_ROOT%>" ) {
11
+ swal({
12
+ title: "<%= t('klastera.user.cluster_root_asignation.title') %>",
13
+ text: "<%= t('klastera.user.cluster_root_asignation.text') %>",
14
+ type: "warning",
15
+ showCancelButton: true,
16
+ confirmButtonText: "<%= t('klastera.user.assign_cluster_role') %>",
17
+ cancelButtonText: "<%= t('klastera.actions.cancel') %>",
18
+ }, function (isConfirm) {
19
+ if ( ! isConfirm ) {
20
+ $('[name="user[cluster_role]"]').val("");
21
+ }
22
+ });
23
+ }
24
+ });
25
+ </script>
26
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <tr class="nested-fields">
2
+ <td class="field">
3
+ <%= f.select :cluster_id, current_organization.clusters.map{|c|[c.name,c.id]}, { include_blank: true }, { class: 'form-control' } %>
4
+ </td>
5
+ <td class="action vertical-align-middle" width="44">
6
+ <%= link_to_remove_association f, class: 'btn btn-danger btn-xs text-danger' do %>
7
+ <i class="fa fa-trash"></i>
8
+ <% end %>
9
+ </td>
10
+ </tr>
@@ -0,0 +1,20 @@
1
+ <% if @user.need_cluster_assignation? %>
2
+ <div class="panel panel-default">
3
+ <div class="panel-heading">
4
+ <h4 class="panel-title">
5
+ <div class="float-left" style="line-height: 20px"><%=t('klastera.clusters.title')%></div>
6
+ <%= link_to_add_association f, :cluster_users, partial: 'layouts/klastera/cluster_user_fields', data: { 'association-insertion-node': :'tbody.cluster-user-rows', 'association-insertion-method': :append }, class: 'btn btn-success btn-xs float-right color-white' do %>
7
+ <i class="fa fa-plus"></i>
8
+ <% end %>
9
+ <div class="clearfix">
10
+ </h4>
11
+ </div>
12
+ <table id="cluster-users" class="table">
13
+ <tbody class="cluster-user-rows">
14
+ <%= f.fields_for :cluster_users do |cluster_user|%>
15
+ <%= render 'layouts/klastera/cluster_user_fields', f: cluster_user %>
16
+ <% end %>
17
+ </body>
18
+ </table>
19
+ </div>
20
+ <% end %>
@@ -0,0 +1,38 @@
1
+ <div class="form-group">
2
+ <%= f.label t('klastera.use_cluster_as') %>
3
+ <span
4
+ class="klastera-cluster-option"
5
+ data-title="<%= t('klastera.help.popover.title')%>"
6
+ data-toggle="popover"
7
+ data-content="<%=
8
+ t('klastera.help.popover.content',
9
+ m1:t('klastera.help.suborganization', t: t('klastera.suborganization')),
10
+ m2:t('klastera.help.required_filter', t: t('klastera.required_filter'), e: t('klastera.clusters.entities')),
11
+ m3:t('klastera.help.optional_filter', t: t('klastera.optional_filter'), e: t('klastera.clusters.entities'))
12
+ )%>"
13
+ >
14
+ <%= fa_icon 'info-circle', class: 'btn-link' %>
15
+ </span>
16
+ <%= f.select :use_cluster_as, Cluster::MODES.map{|cm|[t("klastera.#{cm}"),cm]}, { include_blank: true }, { class: 'form-control' } %>
17
+ </div>
18
+
19
+ <script type="text/javascript">
20
+ var popoverTemplate = '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
21
+ $('.klastera-cluster-option').popover({ template: popoverTemplate, html: true, trigger: 'click', });
22
+ </script>
23
+
24
+ <style type="text/css">
25
+ ul.klastera-option-help {
26
+ padding-left: 20px;
27
+ list-style-type: disc;
28
+ }
29
+
30
+ ul.klastera-option-help li {
31
+ margin-bottom: 10px;
32
+ padding-bottom: 5px;
33
+ border-bottom: 1px solid #DDD;
34
+ }
35
+
36
+ ul.klastera-option-help li b { color: #8A8A8A; font-weight: 400; }
37
+ ul.klastera-option-help li b:first-child { color: #2E5F9B; font-weight: bold; }
38
+ </style>
@@ -0,0 +1,78 @@
1
+ es:
2
+ klastera:
3
+ user:
4
+ add_cluster: Agregar cluster
5
+ you_need_add_at_least_one_cluster: Todos los usuarios deben pertenecer a algún cluster, exceptos aquellos con cluster rol de tipo admin
6
+ assign_cluster_role: Asignar role
7
+ cluster_root_asignation:
8
+ title: Asignación Routing Super Admin
9
+ text: Este rol es sólo para usuarios Routing
10
+ roles:
11
+ root: Routing Super Admin
12
+ admin: Admin Cliente [ Ignora asignación, ve todos los clusters ]
13
+ user: Usuario normal [ Ve sólo los clusters asignados ]
14
+ using_cluster_as: Usando cluster como
15
+ cluster_role: Cluster rol
16
+ cluster_name: Nombre
17
+ cluster_nid: Código
18
+ cluster_color: Color
19
+ organization_name: Organización
20
+ use_cluster_as: Activar y usar cluster como
21
+ suborganization: Sub-organización
22
+ required_filter: Filtro obligatorio
23
+ optional_filter: Filtro opcional
24
+ clusters:
25
+ title: Clusters
26
+ siblings: Seleccione un cluster
27
+ cant_delete: No se puede eliminar
28
+ wrong_option: "%{value} es una opción inválida"
29
+ entities: "[agregar entidades]"
30
+ index:
31
+ title: Gestión de clusters
32
+ new:
33
+ title: Nuevo Cluster
34
+ edit:
35
+ title: Editar Cluster %{cluster_nid}
36
+ destroy:
37
+ title: Eliminar Cluster %{cluster_nid}
38
+ transfer:
39
+ title: Eliminar Cluster %{cluster_nid}
40
+ required: Para eliminar el Cluster es necesario asignar las entidades asociadas a un nuevo Cluster
41
+ optional: Entidades asociadas al Cluster pueden quedar sin asignar o ser asignadas a un nuevo Cluster
42
+ actions:
43
+ cancel: Cancelar
44
+ add: Agregar
45
+ delete: Eliminar
46
+ create: Crear
47
+ update: Actualizar
48
+ deleted: Eliminado
49
+ created: Creado
50
+ updated: Actualizado
51
+ messages:
52
+ record_action_successfully: Registro %{a} exitosamente
53
+ cant_delete_the_last_record_in_suborganization_mode: No se puede eliminar el único cluster de esta organización
54
+ new_cluster_id:
55
+ nil: Cluster no existe
56
+ same: Cluster no puede ser el mismo
57
+ current_cluster:
58
+ cant_transfer: No se puede eliminar ni mover el cluster
59
+ access_cluster_admin: No puede acceder a esta página
60
+ help:
61
+ popover:
62
+ title: Descripción de cada opción
63
+ content: "<ul class='klastera-option-help'><li>%{m1}</li><li>%{m2}</li><li>%{m3}</li></ul>"
64
+ suborganization: "<b>%{t}</b>: Considera los clusters como suborganizaciones."
65
+ required_filter: "<b>%{t}</b>: Obliga a definir un cluster en las entidades %{e}."
66
+ optional_filter: "<b>%{t}</b>: Permite definir un cluster en las entidades %{e} de forma opcional."
67
+ activemodel:
68
+ attributes:
69
+ 'klastera/transfer':
70
+ new_cluster_id: Cluster a transferir
71
+ activerecord:
72
+ models:
73
+ 'klastera/cluster':
74
+ one: Cluster
75
+ other: Clusters
76
+ attributes:
77
+ organization:
78
+ use_cluster_as: Activar y usar cluster como
data/config/routes.rb ADDED
@@ -0,0 +1,7 @@
1
+ Klastera::Engine.routes.draw do
2
+ resources :clusters, except: [:show] do
3
+ member do
4
+ get :transfer
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ class CreateKlasteraClusters < ActiveRecord::Migration
2
+ def change
3
+ create_table :clusters do |t|
4
+ t.references :organization
5
+ t.text :name
6
+ t.string :nid
7
+ t.string :color
8
+
9
+ t.timestamps null: false
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ class AddClusterOptionsToOrganizations < ActiveRecord::Migration
2
+ def change
3
+ add_column :organizations, :use_cluster_as, :string
4
+ add_index :organizations, :use_cluster_as, using: :btree
5
+ #add_column :organizations, :use_cluster_as_suborganization, :boolean, default: false
6
+ #add_column :organizations, :use_cluster_as_required_filter, :boolean, default: false
7
+ #add_column :organizations, :use_cluster_as_optional_filter, :boolean, default: false
8
+ end
9
+
10
+ def migrate(direction)
11
+ super
12
+ if direction == :up
13
+ execute <<-SQL
14
+ -- COMMENT ON COLUMN "organizations"."use_cluster_as_suborganization" IS 'force_cluster';
15
+ -- COMMENT ON COLUMN "organizations"."use_cluster_as_required_filter" IS 'use_cluster';
16
+ -- COMMENT ON COLUMN "organizations"."use_cluster_as_optional_filter" IS 'show_cluster';
17
+ SQL
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,9 @@
1
+ class CreateKlasteraClusterUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :cluster_users do |t|
4
+ t.integer :user_id
5
+ t.string :cluster_id
6
+ end
7
+ add_column :users, :cluster_role, :string
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Klastera
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Klastera
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Klastera
2
+ VERSION = "1.0.0"
3
+ end
data/lib/klastera.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "klastera/engine"
2
+
3
+ module Klastera
4
+ mattr_accessor :organization_class
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :klastera do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,52 @@
1
+ require 'test_helper'
2
+
3
+ module Klastera
4
+ class ClustersControllerTest < ActionController::TestCase
5
+ setup do
6
+ @cluster = klastera_clusters(:one)
7
+ @routes = Engine.routes
8
+ end
9
+
10
+ test "should get index" do
11
+ get :index
12
+ assert_response :success
13
+ assert_not_nil assigns(:clusters)
14
+ end
15
+
16
+ test "should get new" do
17
+ get :new
18
+ assert_response :success
19
+ end
20
+
21
+ test "should create cluster" do
22
+ assert_difference('Cluster.count') do
23
+ post :create, cluster: { color: @cluster.color, name: @cluster.name, nid: @cluster.nid }
24
+ end
25
+
26
+ assert_redirected_to cluster_path(assigns(:cluster))
27
+ end
28
+
29
+ test "should show cluster" do
30
+ get :show, id: @cluster
31
+ assert_response :success
32
+ end
33
+
34
+ test "should get edit" do
35
+ get :edit, id: @cluster
36
+ assert_response :success
37
+ end
38
+
39
+ test "should update cluster" do
40
+ patch :update, id: @cluster, cluster: { color: @cluster.color, name: @cluster.name, nid: @cluster.nid }
41
+ assert_redirected_to cluster_path(assigns(:cluster))
42
+ end
43
+
44
+ test "should destroy cluster" do
45
+ assert_difference('Cluster.count', -1) do
46
+ delete :destroy, id: @cluster
47
+ end
48
+
49
+ assert_redirected_to clusters_path
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "klastera"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
+ # config.time_zone = 'Central Time (US & Canada)'
17
+
18
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
+ # config.i18n.default_locale = :de
21
+
22
+ # Do not swallow errors in after_commit/after_rollback callbacks.
23
+ config.active_record.raise_in_transactional_callbacks = true
24
+ end
25
+ end
26
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1 @@
1
+ test/dummy/config/var/www/rails/llegando/config/database.yml
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,41 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
+ # yet still be able to expire them through the digest params.
32
+ config.assets.digest = true
33
+
34
+ # Adds additional error checking when serving assets at runtime.
35
+ # Checks for improperly declared sprockets dependencies.
36
+ # Raises helpful error messages.
37
+ config.assets.raise_runtime_errors = true
38
+
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
41
+ end