Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
revert back to original thermometer form partial
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuuleh committed Nov 20, 2018
1 parent 5061bb0 commit ebb9297
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 27 deletions.
2 changes: 2 additions & 0 deletions app/controllers/plugins_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class PluginsController < ApplicationController
before_action :find_page

Expand All @@ -12,6 +13,7 @@ def index
end

def show
pp 'PARAMS:', params
@plugin = Plugins.find_for(params[:type], params[:id])
end

Expand Down
1 change: 1 addition & 0 deletions app/models/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def names
end

def find_for(plugin_class, plugin_id)
pp 'PLUGIN CLASS:', plugin_class.camelize
Plugins.const_get(plugin_class.camelize).find(plugin_id)
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/views/pages/edit.slim
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ section.page-edit-step#layout data-icon='cog'
- next if low_priority_plugins.include? plugin.class
section.page-edit-step id=plugin_section_id(plugin) data-icon=plugin_icon(plugin)
h1.page-edit-step__title= plugin_title(plugin)
= render "#{plugin.class.name.underscore.pluralize}/form", plugin: plugin, page: @page
= render "#{plugin.class.base_class.name.underscore.pluralize}/form", plugin: plugin, page: @page

section.page-edit-step#pictures data-icon='camera-retro'
h1.page-edit-step__title = t('.pictures')
Expand All @@ -33,7 +33,7 @@ section.page-edit-step#sources data-icon='link'
- next unless low_priority_plugins.include? plugin.class
section.page-edit-step id=plugin_section_id(plugin) data-icon=plugin_icon(plugin)
h1.page-edit-step__title= plugin_title(plugin)
= render "#{plugin.class.name.underscore.pluralize}/form", plugin: plugin, page: @page
= render "#{plugin.class.base_class.name.underscore.pluralize}/form", plugin: plugin, page: @page

section.page-edit-step.page-edit-step--just-title#review data-icon='eye' data-link-to=member_facing_page_url(@page)
h1.page-edit-step__title
Expand Down
19 changes: 0 additions & 19 deletions app/views/plugins/actions_thermometers/_actions_thermometer.liquid

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/plugins/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
= page_nav_item(plugin_title(plugin), path)

.col-md-10
= render partial: "#{@plugin.class.name.underscore.pluralize}/form", locals: { plugin: @plugin, page: @page }
= render partial: "#{@plugin.class.base_class.name.underscore.pluralize}/form", locals: { plugin: @plugin, page: @page }


Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.col-md-7
= render partial: 'plugins/shared/toggle_form', locals: { plugin: plugin, path: plugins_thermometer_path(plugin) }

- name = "plugins_thermometer_#{plugin.id}"
- name = "plugins_actions_thermometer_#{plugin.id}"
= form_for plugin, url: plugins_thermometer_path(plugin), remote: true, as: name, html: {class: 'plugin-settings one-form', data: {type: name }} do |f|
= render "shared/error_messages", target: plugin
= render "shared/success_message", success: (defined?(success) || false)
Expand Down
11 changes: 7 additions & 4 deletions app/views/plugins/thermometers/_thermometer.liquid
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{% if plugins.thermometer[ref].active %}
<!-- This is the template for ActionsThermometer. It needed to keep under _thermometer.liquid partial name
to ensure that all legacy templates (including the ones seeded into the DB and no longer in the filesystem)
continued to work. This template is not used by DonationsThermometer. -->
{% if plugins.actions_thermometer[ref].active %}
<!-- this partial will be cached, so the javascript replaces the
values for signature, remaining, and thermometer width -->
<div class='thermometer'>
<div class="thermometer__stats">
<div class='thermometer__signatures'>
{{ plugins.thermometer[ref].signatures }} {{ 'thermometer.signatures' | t }}
{{ plugins.actions_thermometer[ref].signatures }} {{ 'thermometer.signatures' | t }}
</div>
<div class="thermometer__remaining">
{{ 'thermometer.signatures_until_goal' |
val: 'goal', plugins.thermometer[ref].goal_k |
val: 'remaining', plugins.thermometer[ref].remaining | t }}
val: 'goal', plugins.actions_thermometer[ref].goal_k |
val: 'remaining', plugins.actions_thermometer[ref].remaining | t }}
</div>
</div>
<div class="thermometer__bg">
Expand Down

0 comments on commit ebb9297

Please sign in to comment.