[Git][noosfero/noosfero][master] 2 commits: [CustomForms] Uses date helper on query views
Rodrigo Souto
gitlab at mg.gitlab.com
Mon Aug 6 17:03:19 BRT 2018
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
50b8c4bc by Gabriel Silva at 2018-08-02T17:15:03Z
[CustomForms] Uses date helper on query views
Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>
- - - - -
41262e98 by Rodrigo Souto at 2018-08-06T20:03:15Z
Merge branch 'custom-forms-remaining-2' into 'master'
[master/CustomForms] Uses date helper on query views
See merge request noosfero/noosfero!1591
- - - - -
9 changed files:
- plugins/custom_forms/controllers/custom_forms_plugin_myprofile_controller.rb
- plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb
- plugins/custom_forms/lib/custom_forms_plugin/form.rb
- plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb
- plugins/custom_forms/views/custom_forms_plugin_myprofile/index.html.erb
- plugins/custom_forms/views/custom_forms_plugin_myprofile/pending.html.erb
- plugins/custom_forms/views/custom_forms_plugin_myprofile/submissions.html.erb
- plugins/custom_forms/views/custom_forms_plugin_profile/_queries_content.html.erb
- plugins/custom_forms/views/custom_forms_plugin_profile/review.html.erb
Changes:
=====================================
plugins/custom_forms/controllers/custom_forms_plugin_myprofile_controller.rb
=====================================
@@ -1,8 +1,7 @@
require 'csv'
class CustomFormsPluginMyprofileController < MyProfileController
-
- include CustomFormsPlugin::Helper
+ helper CustomFormsPlugin::Helper
protect 'post_content', :profile
=====================================
plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb
=====================================
@@ -1,9 +1,9 @@
class CustomFormsPluginProfileController < ProfileController
+ helper CustomFormsPlugin::Helper
+
before_filter :has_access, :only => [:show]
before_filter :can_view_results, :only => [:review]
- include CustomFormsPlugin::Helper
-
def show
profile = Profile.find_by(identifier: params[:profile])
@form = profile.forms.find_by(identifier: params[:id])
=====================================
plugins/custom_forms/lib/custom_forms_plugin/form.rb
=====================================
@@ -122,27 +122,6 @@ class CustomFormsPlugin::Form < ApplicationRecord
image.present? ? image.full_path : default_img_url
end
- def duration_in_days
- if begining == nil and ending == nil
- return _("This query has no ending date")
- end
- seconds_to_days = 86400
- days = (ending.to_i - begining.to_i) / seconds_to_days
- if days < 1
- return _("Ends today")
- end
-
- if days >= 1 && days < 2
- return _("Ends tomorow")
- end
-
- if days < 0
- return _("Already closed")
- end
-
- return _("%s days left") % days
- end
-
def status
if begining.try(:future?)
:not_open
=====================================
plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb
=====================================
@@ -1,5 +1,3 @@
-<% self.extend(CustomFormsPlugin::Helper) %>
-
<%= error_messages_for :form %>
<%= required labelled_form_field _('Name'), f.text_field(:name) %>
<% address_field = content_tag('code', "/profile/#{profile.identifier}/query/".html_safe + f.text_field(:identifier)).html_safe %>
=====================================
plugins/custom_forms/views/custom_forms_plugin_myprofile/index.html.erb
=====================================
@@ -1,5 +1,3 @@
-<% self.extend CustomFormsPlugin::Helper %>
-
<h1><%= _('Manage queries') %></h1>
<% tabs = [] %>
=====================================
plugins/custom_forms/views/custom_forms_plugin_myprofile/pending.html.erb
=====================================
@@ -1,5 +1,3 @@
-<% self.extend CustomFormsPlugin::Helper %>
-
<h1><%= _('Pending submissions for %s') % @form.name %></h1>
<% if @pendings.empty? %>
=====================================
plugins/custom_forms/views/custom_forms_plugin_myprofile/submissions.html.erb
=====================================
@@ -1,5 +1,3 @@
-<% self.extend CustomFormsPlugin::Helper %>
-
<h3><%= _('Submissions for %s') % @form.name %></h3>
<% if @form.submissions.empty? %>
=====================================
plugins/custom_forms/views/custom_forms_plugin_profile/_queries_content.html.erb
=====================================
@@ -1,5 +1,3 @@
-<% self.extend(CustomFormsPlugin::Helper) %>
-
<div id='queries'>
<ul class="results-list">
<% if @forms.present? %>
=====================================
plugins/custom_forms/views/custom_forms_plugin_profile/review.html.erb
=====================================
@@ -3,7 +3,7 @@
<div class="query-header">
<i class="fa fa-hourglass" aria-hidden="true"></i>
- <span><%= @form.duration_in_days %></span>
+ <span><%= time_status(@form) %></span>
<span class="bullet">•</span>
<i class="fa fa-users" aria-hidden="true"></i>
<span><%= _(pluralize(@form.submissions.count, 'participant')) %></span>
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/a51025f089da9e1c72b76211766fe46f52b99fa1...41262e98dc1cd162410a0520865c69bb21ea0a6c
--
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/a51025f089da9e1c72b76211766fe46f52b99fa1...41262e98dc1cd162410a0520865c69bb21ea0a6c
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180806/d645a344/attachment-0001.html>
More information about the Noosfero-dev
mailing list