diff --git a/app/controllers/admin/homepage_controller.rb b/app/controllers/admin/homepage_controller.rb
new file mode 100644
index 000000000..1de56b10f
--- /dev/null
+++ b/app/controllers/admin/homepage_controller.rb
@@ -0,0 +1,12 @@
+class Admin::HomepageController < Admin::BaseController
+
+ def show
+ end
+
+ private
+
+ def load_settings
+ settings = /feature.homepage.widgets/
+ @settings = Setting.select {|setting| setting.key =~ /#{settings}/ }
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb
index 14dfc6658..5b7147026 100644
--- a/app/controllers/admin/settings_controller.rb
+++ b/app/controllers/admin/settings_controller.rb
@@ -11,7 +11,7 @@ class Admin::SettingsController < Admin::BaseController
def update
@setting = Setting.find(params[:id])
@setting.update(settings_params)
- redirect_to admin_settings_path, notice: t("admin.settings.flash.updated")
+ redirect_to request.referer, notice: t("admin.settings.flash.updated")
end
def update_map
diff --git a/app/controllers/admin/widget/base_controller.rb b/app/controllers/admin/widget/base_controller.rb
new file mode 100644
index 000000000..1f9aeffc4
--- /dev/null
+++ b/app/controllers/admin/widget/base_controller.rb
@@ -0,0 +1,10 @@
+class Admin::Widget::BaseController < Admin::BaseController
+ helper_method :namespace
+
+ private
+
+ def namespace
+ "admin"
+ end
+
+end
diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb
index 134725cda..7336aad77 100644
--- a/app/views/admin/_menu.html.erb
+++ b/app/views/admin/_menu.html.erb
@@ -167,6 +167,10 @@
>
+ - >
+ <%= link_to "Homepage", admin_homepage_path %>
+
+
- >
<%= link_to t("admin.menu.site_customization.pages"), admin_site_customization_pages_path %>
@@ -179,6 +183,7 @@
- >
<%= link_to t("admin.menu.site_customization.content_blocks"), admin_site_customization_content_blocks_path%>
+
diff --git a/app/views/admin/homepage/_setting.html.erb b/app/views/admin/homepage/_setting.html.erb
new file mode 100644
index 000000000..89221e793
--- /dev/null
+++ b/app/views/admin/homepage/_setting.html.erb
@@ -0,0 +1,11 @@
+
+ <%= form_for(setting, url: admin_setting_path(setting), method: :put) do |f| %>
+
+ <%= f.hidden_field :value,
+ value: (setting.enabled? ? "" : "active") %>
+
+ <%= f.submit(t("admin.settings.index.features.#{setting.enabled? ? 'disable' : 'enable'}"),
+ class: "button expanded #{setting.enabled? ? 'hollow alert' : 'success'}",
+ data: {confirm: t("admin.actions.confirm")}) %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/admin/homepage/show.html.erb b/app/views/admin/homepage/show.html.erb
new file mode 100644
index 000000000..3da4a9af5
--- /dev/null
+++ b/app/views/admin/homepage/show.html.erb
@@ -0,0 +1,11 @@
+Homepage
+
+The active modules appear in the homepage in the same order as here.
+<% @settings.each do |setting| %>
+
+
+ <%= t("settings.#{setting.key}") %>
+
+
+ <%= render "setting", setting: setting %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/widget/_menu.html.erb b/app/views/admin/widget/_menu.html.erb
new file mode 100644
index 000000000..08efd87dc
--- /dev/null
+++ b/app/views/admin/widget/_menu.html.erb
@@ -0,0 +1 @@
+<%= render "admin/menu" %>
\ No newline at end of file
diff --git a/config/locales/en/settings.yml b/config/locales/en/settings.yml
index 6d63890c2..1b4444274 100644
--- a/config/locales/en/settings.yml
+++ b/config/locales/en/settings.yml
@@ -41,7 +41,7 @@ en:
voting_allowed: Voting on investment projects
legislation: Legislation
user:
- recommendations: Recommendeds
+ recommendations: Recommendations
skip_verification: Skip user verification
community: Community on proposals and investments
map: Proposals and budget investments geolocation
diff --git a/config/routes/admin.rb b/config/routes/admin.rb
index 6bf380f0c..251a13783 100644
--- a/config/routes/admin.rb
+++ b/config/routes/admin.rb
@@ -179,4 +179,7 @@ namespace :admin do
resources :images, only: [:index, :update, :destroy]
resources :content_blocks, except: [:show]
end
+
+ resource :homepage, controller: :homepage
+
end
diff --git a/spec/features/home_spec.rb b/spec/features/home_spec.rb
index 0e26c6711..90a267eea 100644
--- a/spec/features/home_spec.rb
+++ b/spec/features/home_spec.rb
@@ -2,7 +2,7 @@ require 'rails_helper'
feature "Home" do
- feature "For not logged users" do
+ context "For not logged users" do
scenario 'Welcome message' do
visit root_path
@@ -20,7 +20,7 @@ feature "Home" do
end
- feature "For signed in users" do
+ context "For signed in users" do
feature "Recommended" do