Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 18 files changed
  • 0 commit comments
  • 1 contributor
View
4 app/controllers/application_controller.rb
@@ -30,6 +30,10 @@ def check_enabled!(feature)
end
end
+ def only_unauthenticated_user
+ redirect_to(root_path) if current_user
+ end
+
private
def not_found
raise ActionController::RoutingError.new('Not Found')
View
2  app/controllers/reports_controller.rb
@@ -3,7 +3,7 @@ class ReportsController < ApplicationController
before_filter :project_exists?
def bids_over_time
- dates = @project.posted_at.to_date..([Time.now, @project.bids_due_at].min).to_date
+ dates = @project.posted_at.to_date..(@project.bids_due_at ? [Time.now, @project.bids_due_at].min : Time.now).to_date
bids = @project.bids.submitted
@data = [['Date', '# of bids']]
View
1  app/controllers/users_controller.rb
@@ -1,5 +1,6 @@
class UsersController < ApplicationController
before_filter :authenticate_user!, except: [:signin, :post_signin, :forgot_password, :post_forgot_password]
+ before_filter :only_unauthenticated_user, only: [:signin, :post_signin, :forgot_password, :post_forgot_password]
def signin
if (path = URI(request.referer).path) != users_signin_path
View
19 app/mailers/saved_search_mailer.rb
@@ -1,20 +1,23 @@
class SavedSearchMailer < ActionMailer::Base
- default from: "from@example.com"
-
+ include EmailBuilder
include ActionView::Helpers::TextHelper
# @todo send more than 10 results
def search_email(vendor)
- @count = 0
-
- @vendor = vendor
+ count = 0
+ results_string = ""
vendor.saved_searches.each do |saved_search|
- @count += saved_search.execute_since_last_search[:meta][:total]
+ count += saved_search.execute_since_last_search[:meta][:total]
+ results_string += render_to_string("saved_search_mailer/_results", locals: { saved_search: saved_search } )
end
- if @count > 0
- message = mail(to: vendor.email, subject: "#{pluralize(@count, 'new result')} for your saved searches on Procure.io")
+ if count > 0
+ message = build_email vendor.email,
+ 'saved_searches',
+ pluralized_count: t('mailers.saved_searches.pluralized_count', count: count),
+ name: vendor.display_name,
+ results: results_string
end
vendor.saved_searches.each do |saved_search|
View
4 app/views/layouts/_dropdown_login_form.html.haml
@@ -5,9 +5,9 @@
= password_field_tag :password, nil, placeholder: t('globals.password')
.login-button-wrapper
%button.btn.btn-primary= t('globals.sign_in')
- = t('.or_sign_up.line_html', link: link_to(t('.or_sign_up.link'), new_vendor_registration_path))
+ = t('users.or_sign_up.line_html', link: link_to(t('users.or_sign_up.link'), new_vendor_registration_path))
.forgot-password-wrapper
- = t('.forgot_password.line_html', link: link_to(t('.forgot_password.link'), users_forgot_password_path))
+ = t('users.forgot_password.line_html', link: link_to(t('users.forgot_password.link'), users_forgot_password_path))
View
10 app/views/questions/index.html.haml
@@ -3,11 +3,11 @@
%table.table.table-nonfluid
%thead
%tr
- %th Created at
- %th Vendor
- %th{"width" => "35%"} Body
- %th{"width" => "35%"} Answer
- %th Actions
+ %th= Question.human_attribute_name(:created_at)
+ %th= Question.human_attribute_name(:vendor)
+ %th{"width" => "35%"}= Question.human_attribute_name(:body)
+ %th{"width" => "35%"}= Question.human_attribute_name(:answer_body)
+ %th= t('globals.actions')
%tbody#questions-tbody
:javascript
View
8 app/views/reports/_sidebar.html.haml
@@ -1,13 +1,13 @@
.row-fluid
.span3
- %h4 General Stats
+ %h4= t('.general_stats')
%ul.nav.nav-pills.nav-stacked
%li{"class" => active?("reports#bids_over_time")}
- =link_to "Bids over time", bids_over_time_project_reports_path(@project)
+ =link_to t('.bids_over_time'), bids_over_time_project_reports_path(@project)
%li{"class" => active?("reports#impressions")}
- =link_to "Impressions", impressions_project_reports_path(@project)
+ =link_to t('.impressions'), impressions_project_reports_path(@project)
- %h4 Response Fields
+ %h4= t('.response_fields')
%ul.nav.nav-pills.nav-stacked
- @project.response_fields.where("field_type IN (?)", ResponseField::REPORTABLE_FIELDS).each do |response_field|
%li{"class" => active?("reports#response_field?response_field_id=#{response_field.id}")}
View
2  app/views/reports/common.html.haml
@@ -7,4 +7,4 @@
:javascript
ProcureIo.chartData = #{@data.to_json};
- else
- %p Sorry, no data to display.
+ %p= t('reports.common.no_data')
View
8 app/views/saved_search_mailer/_results.text.erb
@@ -0,0 +1,8 @@
+<%= raw saved_search.search_parameters %>
+--------------
+<% saved_search.execute_since_last_search[:results].each do |project| %>
+Title: <%= project.title %>
+Link: <%= project_url(project.id) %>
+Abstract: <%= project.abstract %>
+
+<% end %>
View
20 app/views/saved_search_mailer/search_email.text.erb
@@ -1,20 +0,0 @@
-Hey <%= @vendor.display_name %>,
-
-We found <%= pluralize(@count, 'new result') %> for your saved searches on Procure.io.
-
-<% @vendor.saved_searches.each do |saved_search| %>
-<%= raw saved_search.search_parameters %>
---------------
-<% saved_search.execute_since_last_search[:results].each do |project| %>
-Title: <%= project.title %>
-Link: <%= project_url(project.id) %>
-Abstract: <%= project.abstract %>
-
-<% end %>
-<% if saved_search.execute_since_last_search[:meta][:total] == 0 %>
-No new results.
-<% end %>
-
-<% end %>
-
--- Procure.io
View
14 app/views/saved_searches/index.html.haml
@@ -1,21 +1,21 @@
-!=page_header "Saved Searches"
+!=page_header t('.header')
-.alert.alert-info These are your saved searches. You'll receive daily emails with links to any new projects posted that match these parameters.
+.alert.alert-info= t('.description')
%table.table
%thead
%tr
- %th Parameters
- %th Current Results
- %th Actions
+ %th= SavedSearch.human_attribute_name(:parameters)
+ %th= t('saved_searches.current_results')
+ %th= t('globals.actions')
%tbody
- @saved_searches.each do |saved_search|
%tr
%td= saved_search.search_parameters
%td
%span.badge= saved_search.execute[:meta][:total]
- %a{"href" => projects_path(saved_search.search_parameters)} View Results
+ %a{"href" => projects_path(saved_search.search_parameters)}= t('.view_results')
%td
- =link_to "Destroy", saved_search, class: "btn btn-danger", method: :delete
+ =link_to t('actions.saved_search.delete'), saved_search, class: "btn btn-danger", method: :delete
= will_paginate @saved_searches, class: "pagination pagination-centered"
View
2  app/views/users/_notification_settings.html.haml
@@ -1,4 +1,4 @@
-%h4 Email Notifications
+%h4= t('.header')
- event_types.each do |k, v|
%label.checkbox
View
7 app/views/users/forgot_password.html.haml
@@ -1,9 +1,8 @@
-!=page_header "Forgot password"
+!=page_header t('.header')
= form_tag users_forgot_password_path, method: :post do
- %label Email
- = text_field_tag :email, nil, placeholder: "Email Address"
+ = text_field_tag :email, nil, placeholder: t('globals.email_address')
.form-actions
- %button.btn.btn-primary Send reset password instructions
+ %button.btn.btn-primary= t('.send_instructions')
View
10 app/views/users/officer_settings.html.haml
@@ -1,8 +1,8 @@
-!=page_header "Settings"
+!=page_header t('.header')
= form_for current_officer, url: settings_path do |f|
- %h4 Profile
+ %h4= t('.profile')
= f.label :name
= f.text_field :name
@@ -10,10 +10,10 @@
= f.label :title
= f.text_field :title
- %h4 Developer
- %label API Key
+ %h4= t('.dev_header')
+ %label= t('.api_key')
%code.js-api-key-hide.hide= current_officer.authentication_token
- %a.js-api-key-hide{"data-toggle" => "showhide", "data-target" => ".js-api-key-hide", "data-toggle-text" => "(hide)"} (show)
+ %a.js-api-key-hide{"data-toggle" => "showhide", "data-target" => ".js-api-key-hide", "data-toggle-text" => t('globals.hide_paren')}= t('globals.show_paren')
= render 'users/notification_settings', event_types: Officer.event_types
View
16 app/views/users/signin.html.haml
@@ -1,16 +1,16 @@
-!=page_header "Sign in"
+!=page_header t('globals.sign_in')
= form_tag users_signin_path, method: :post do
- %label Email
- = text_field_tag :email, nil, placeholder: "Email Address"
+ %label= t('globals.email_address')
+ = text_field_tag :email, nil, placeholder: t('globals.email_address')
- %label Password
- = password_field_tag :password, nil, placeholder: "Password"
+ %label= t('globals.password')
+ = password_field_tag :password, nil, placeholder: t('globals.password')
.form-actions
- %button.btn.btn-primary Sign in
- or <a href="#{new_vendor_registration_path}">sign up</a>.
+ %button.btn.btn-primary= t('globals.sign_in')
+ = t('users.or_sign_up.line_html', link: link_to(t('users.or_sign_up.link'), new_vendor_registration_path))
.forgot-password-wrapper
- Did you <a href="#{users_forgot_password_path}">forget your password</a>?
+ = t('users.forgot_password.line_html', link: link_to(t('users.forgot_password.link'), users_forgot_password_path))
View
4 app/views/users/vendor_settings.html.haml
@@ -1,8 +1,8 @@
-!=page_header "Settings"
+!=page_header t('.header')
= form_for current_vendor, url: settings_path do |f|
- %h4 Profile
+ %h4= t('.profile')
= f.label :name
= f.text_field :name
View
4 app/views/watches/vendor_projects.html.haml
@@ -1,7 +1,7 @@
-!=page_header "Watched Projects"
+!=page_header t('.header')
%ul
- @projects.each do |project|
%li
= link_to project.title, project_path(project)
- %small last updated #{project.updated_at.to_formatted_s(:readable)}
+ %small= t('watches.last_updated', date: project.updated_at.to_formatted_s(:readable))
View
76 config/locales/en.yml
@@ -5,12 +5,17 @@ en:
globals:
site_name: Procure.io
sign_in: Sign in
+ sign_up: Sign up
email_address: Email Address
password: Password
actions: Actions
unknown_officer: Unknown
experimental_follow_steps_html: >
<strong>Howdy!</strong> This feature is pretty experimental, so if you do choose to proceed, be sure to follow the steps below.
+ show: "show"
+ hide: "hide"
+ show_paren: "(show)"
+ hide_paren: "(hide)"
confirmations:
bid:
@@ -43,6 +48,9 @@ en:
question:
create: "Submit Question"
+ saved_search:
+ delete: "Delete Saved Search"
+
postable_by_officer:
live: Live
@@ -61,12 +69,6 @@ en:
dropdown_login_form:
sign_in: Sign in to %{site_name}
- or_sign_up:
- line_html: or %{link}
- link: sign up
- forgot_password:
- line_html: Did you %{link}?
- link: forget your password
amendments:
posted_on: "Posted on %{date}"
@@ -247,6 +249,54 @@ en:
<code>%{url}</code>, and be sure to check the box labeled "Include Field and Form Structures with Entry Data".
step_4: Sit back and watch the applications roll in!
+ reports:
+ sidebar:
+ general_stats: "General Stats"
+ bids_over_time: Bids over time
+ impressions: Impressions
+ response_fields: Response fields
+
+ common:
+ no_data: "Sorry, no data to display."
+
+ saved_searches:
+ current_results: Current Results
+ index:
+ header: "Saved Searches"
+ description: "These are your saved searches. You'll receive daily emails with links to any new projects posted that match these parameters."
+ view_results: View Results
+
+ users:
+ notification_settings:
+ header: "Email Notifications"
+
+ forgot_password:
+ header: "Forgot password"
+ send_instructions: "Send reset password instructions"
+
+ officer_settings:
+ header: "Settings"
+ profile: "Profile"
+ dev_header: "Developer"
+ api_key: API Key
+
+ vendor_settings:
+ header: "Settings"
+ profile: Profile
+
+ or_sign_up:
+ line_html: or %{link}
+ link: sign up
+
+ forgot_password:
+ line_html: Did you %{link}?
+ link: forget your password
+
+ watches:
+ last_updated: "last updated %{date}"
+ vendor_projects:
+ header: Watched Projects
+
mailers:
notification:
subject: "%{event_text}"
@@ -259,3 +309,17 @@ en:
%{event_url}
-- %{site_name}
+
+ saved_searches:
+ pluralized_count:
+ one: 1 new result
+ other: "%{count} new results"
+ subject: "%{pluralized_count} for your saved searches on %{site_name}"
+ text: |
+ Hey %{name},
+
+ We found %{pluralized_count} for your saved searches on %{site_name}.
+
+ %{results}
+
+ -- %{site_name}

No commit comments for this range

Something went wrong with that request. Please try again.