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.
base fork: rmarianski/docphoto
base: a4d5722d17
...
head fork: rmarianski/docphoto
compare: c2fe524583
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
4 resources/public/css/docphoto.css
@@ -169,6 +169,10 @@ a:hover {
float: none;
}
+.uniForm span.inline-radio {
+ margin-right: 3em;
+}
+
#page .form-errors {
padding: 10px;
border: 2px solid red;
View
127 src/docphoto/core.clj
@@ -166,8 +166,8 @@
[[closed__c = false noquote]]
:append "order by application_start_date__c desc limit 1"))
-(def mw20-or-prodgrant2012
- (comp #{:mw20 :prodgrant2012} keyword :slug__c :exhibit__r))
+(def mw21-or-prodgrant2012-2
+ (comp #{:mw21 :prodgrant2012-2} keyword :slug__c :exhibit__r))
(cachinate (cache-under :applications)
(defquery query-applications [userid]
@@ -179,7 +179,7 @@
[[exhibit_application__c.contact__r.id = userid]]
:append "order by lastModifiedDate desc")
(fn [form] `(filter
- mw20-or-prodgrant2012
+ mw21-or-prodgrant2012-2
(map tweak-application-result ~form)))))
;; used for cleaning up local disk, so only app ids are returned
@@ -203,8 +203,9 @@
[id biography__c title__c website__c statementRich__c contact__c
submission_Status__c narrative__c multimedia_Link__c cover_Page__c
exhibit__r.name exhibit__r.slug__c exhibit__r.closed__c
- focus_Country_Single_Select__c focus_Region__c
- referredby__c]
+ focus_Country_Single_Select__c focus_Region__c referredby__c
+ english_language_proficiency__c russian_language_proficiency__c
+ additional_language_proficiency__c]
[[id = app-id]])
(fn [form] `(-?> ~form first tweak-application-result))))
@@ -396,13 +397,18 @@
(admin-download-link [] "admin" "download")
(admin-login-as-link [] "admin" "login-as")
(admin-create-vetter-link [] "admin" "create-vetter-account")
- (switch-language-link [lang came-from] "language" lang {:came-from came-from})
(review-request-link [review-request-id] "review-request" review-request-id)
- (login-link [& [came-from]] "login" (when came-from {:came-from came-from}))
(logout-link [] "logout")
(register-link [] "register")
(profile-reset-password-link [user-id] "profile" user-id "password"))
+(defn switch-language-link [lang came-from]
+ (str "/language/" lang "/?came-from=" (ring-codec/url-encode came-from)))
+
+(defn login-link [& [came-from]]
+ (str "/login"
+ (when came-from (str "?came-from=" (ring-codec/url-encode came-from)))))
+
(defn find-remaining-review-requests [review-requests final-reviews]
(let [s (set (map :exhibit_Application__c final-reviews))]
(remove #(s (:exhibit_Application__c %)) review-requests)))
@@ -465,7 +471,7 @@
(let [host (host-header request)]
(if (= host "docphoto.soros.org")
"Production Grant 2012"
- "Moving Walls 20")))
+ "Moving Walls 21")))
(defn layout [request options body]
(xhtml
@@ -547,8 +553,8 @@
(redirect
(str "/exhibit/"
(if (= (host-header request) "docphoto.soros.org")
- "prodgrant2012"
- "mw20"))))
+ "prodgrant2012-2"
+ "mw21"))))
(defview userinfo-view {:title "User Info View" :logged-in true}
[:dl
@@ -867,6 +873,9 @@
[:findout-friend "Friend"]
[:findout-other "Other"]]}]})
+(def language-fluency-options
+ (map #(vector % (string/capitalize (name %))) [:beginner :intermediate :advanced :fluent]))
+
(def application-fields
;; common fields
@@ -886,20 +895,20 @@
;; these are listed here to prevent duplication with the fields
;; listed for review
- ;; mw20 fields
- :mw20-project-title (req-textfield :title__c "Project Title")
- :mw20-project-summary {:field [:text-area#coverpage.editor {:style "height: 50px"} :cover_Page__c
+ ;; mw21 fields
+ :mw21-project-title (req-textfield :title__c "Project Title")
+ :mw21-project-summary {:field [:text-area#coverpage.editor {:style "height: 50px"} :cover_Page__c
{:label "Project Summary"
:description "A one sentence description of the project, including title (if applicable) and main subject/content."}]
:validator {:fn not-empty :msg :required}}
- :mw20-project-statement {:field [:text-area#statement.editor {:style "height: 500px"} :statementRich__c
+ :mw21-project-statement {:field [:text-area#statement.editor {:style "height: 500px"} :statementRich__c
{:label "Project Statement" :description "(600 words maximum) describing the project you would like to exhibit"}]
:validator {:fn not-empty :msg :required}}
- :mw20-bio {:field [:text-area#biography.editor {:style "height: 250px"} :biography__c
+ :mw21-bio {:field [:text-area#biography.editor {:style "height: 250px"} :biography__c
{:label "Short Narrative Bio"
:description "(250 words maximum) summarizing your previous work and experience"}]
:validator {:fn not-empty :msg :required}}
- :mw20-summary-of-engagement {:field [:text-area#summaryEngagement.editor {:style "height: 500px"} :narrative__c
+ :mw21-summary-of-engagement {:field [:text-area#summaryEngagement.editor {:style "height: 500px"} :narrative__c
{:label "Summary of your engagement"
:description "(600 words maximum) Please comment on your relationship with the issue or community you photographed. How and why did you begin the project? How long have you been working on the project? Are there particular methods you use while working? What do you hope a viewer will take away from your project?"}]
:validator {:fn not-empty :msg :required}}
@@ -920,16 +929,25 @@
:validator {:fn not-empty :msg :required}}
:pg-personal-statement {:field [:text-area#personal-statement.editor {:style "height: 500px"} :biography__c
{:label :pg-personal-statement :description :pg-personal-statement-description}]
- :validator {:fn not-empty :msg :required}}})
+ :validator {:fn not-empty :msg :required}}
+ :pg-english-language-proficiency {:field [:radio-single-line {:class :inline-radio} :english_language_proficiency__c
+ {:label :pg-english-language-proficiency :opts language-fluency-options}]
+ :validator {:fn not-empty :msg :required}}
+ :pg-russian-language-proficiency {:field [:radio-single-line {:class :inline-radio} :russian_language_proficiency__c
+ {:label :pg-russian-language-proficiency :opts language-fluency-options}]
+ :validator {:fn not-empty :msg :required}}
+ :pg-additional-language-proficiency {:field [:text-area {:rows 4} :additional_language_proficiency__c
+ {:label :pg-additional-language-proficiency
+ :description :pg-additional-language-proficiency-description}]}})
(defmulti exhibit-apply-fields (comp keyword :slug__c))
-(defmethod exhibit-apply-fields :mw20 [exhibit]
- [(application-fields :mw20-project-title)
- (application-fields :mw20-project-summary)
- (application-fields :mw20-project-statement)
- (application-fields :mw20-bio)
- (application-fields :mw20-summary-of-engagement)
+(def mw-fields
+ [(application-fields :mw21-project-title)
+ (application-fields :mw21-project-summary)
+ (application-fields :mw21-project-statement)
+ (application-fields :mw21-bio)
+ (application-fields :mw21-summary-of-engagement)
(application-fields :cv)
(findout-field)
(application-fields :website)
@@ -937,7 +955,10 @@
(application-fields :focus-region)
(application-fields :focus-country)])
-(defmethod exhibit-apply-fields :prodgrant2012 [exhibit]
+(defmethod exhibit-apply-fields :mw20 [exhibit] mw-fields)
+(defmethod exhibit-apply-fields :mw21 [exhibit] mw-fields)
+
+(def pg-fields
[(application-fields :pg-project-title)
(application-fields :pg-project-summary)
(application-fields :pg-proposal-narrative)
@@ -947,6 +968,12 @@
(application-fields :focus-region)
(application-fields :focus-country)])
+(defmethod exhibit-apply-fields :prodgrant2012 [exhibit] pg-fields)
+(defmethod exhibit-apply-fields :prodgrant2012-2 [exhibit]
+ (into pg-fields [(application-fields :pg-english-language-proficiency)
+ (application-fields :pg-russian-language-proficiency)
+ (application-fields :pg-additional-language-proficiency)]))
+
(defmulti application-update-fields (comp keyword :slug__c :exhibit__r))
(defn make-cv-field-optional
@@ -961,25 +988,44 @@
field))
fields))
+(defn mw-update-fields [application]
+ (make-cv-field-optional (exhibit-apply-fields (:exhibit__r application))))
+
(defmethod application-update-fields :mw20 [application]
+ (mw-update-fields application))
+(defmethod application-update-fields :mw21 [application]
+ (mw-update-fields application))
+
+(defn pg-update-fields [application]
(make-cv-field-optional (exhibit-apply-fields (:exhibit__r application))))
(defmethod application-update-fields :prodgrant2012 [application]
- (make-cv-field-optional (exhibit-apply-fields (:exhibit__r application))))
+ (pg-update-fields application))
+(defmethod application-update-fields :prodgrant2012-2 [application]
+ (pg-update-fields application))
(defmulti application-review-fields (comp keyword :slug__c :exhibit__r))
-(defmethod application-review-fields :mw20 [application]
+(def mw-review-fields
(map application-fields
- [:mw20-project-title :mw20-project-summary :mw20-project-statement
- :mw20-bio :mw20-summary-of-engagement
+ [:mw21-project-title :mw21-project-summary :mw21-project-statement
+ :mw21-bio :mw21-summary-of-engagement
:website :multimedia]))
-(defmethod application-review-fields :prodgrant2012 [application]
+(defmethod application-review-fields :mw20 [application] mw-fields)
+(defmethod application-review-fields :mw21 [application] mw-fields)
+
+(def pg-review-fields
(map application-fields
[:pg-project-title :pg-project-summary
:pg-proposal-narrative :pg-personal-statement]))
+(defmethod application-review-fields :prodgrant2012 [application] pg-review-fields)
+(defmethod application-review-fields :prodgrant2012-2 [application]
+ (into pg-review-fields [(application-fields :english_language_proficiency__c)
+ (application-fields :russian_language_proficiency__c)
+ (application-fields :additional_language_proficiency__c)]))
+
(defn exhibit-closed? [exhibit] (:closed__c exhibit))
(defview exhibit-closed-view [exhibit]
@@ -1086,7 +1132,8 @@
(normalize-empty-value :focus_Country_Single_Select__c)
(normalize-empty-value :referredby__c)
(normalize-empty-value :website__c)
- (normalize-empty-value :multimedia_Link__c))]
+ (normalize-empty-value :multimedia_Link__c)
+ (normalize-empty-value :additional_language_proficiency__c))]
(sf/update-application conn app-update-map)
(cache-clear :application [app-id])
;; title could have changed too so it's safer to clear
@@ -1420,13 +1467,14 @@
(defmacro prepare-application-routes
"Take care of fetching the application, and checking security. Anaphora: depends on having 'app-id' in context matching and injects 'application' into scope. Expects 'request' symbol in scope."
- [& app-routes]
+ [can-view? & app-routes]
`(fn [~'request]
- (when-application ~'app-id
- (when-logged-in
- (if (can-view-application? ~'user ~'application)
- (routing ~'request ~@app-routes)
- (forbidden ~'request))))))
+ (when-application
+ ~'app-id
+ (when-logged-in
+ (if (~can-view? (:uri ~'request) ~'user ~'application)
+ (routing ~'request ~@app-routes)
+ (forbidden ~'request))))))
(defmacro prepare-exhibit-routes
"Fetch exhibit, and inject 'exhibit' through anaphora. Expects 'exhibit-id' to exist in scope."
@@ -1629,7 +1677,7 @@
(review-view request user-id application review-stage)))
(defn application-review-view [request application]
- (when-admin
+ (when-logged-in
(review-view request (:id user) application)))
(defmacro admin-routes
@@ -1767,6 +1815,10 @@
(context "/application/:app-id" [app-id]
(prepare-application-routes
+ (fn [uri user application]
+ (if (.endsWith ^String uri "/review")
+ (can-review-application? user application)
+ (can-view-application? user application)))
(POST "/upload" [] (app-upload-image request application))
(GET "/upload" [] (app-upload request application))
(POST "/update-images" [] (application-update-images-view request application))
@@ -1793,6 +1845,7 @@
(GET "/cv/:app-id" [app-id :as request]
;; re-using application macro for setup logic
(prepare-application-routes
+ (fn [uri user application] (can-review-application? user application))
(ANY "*" [] (cv-view request application))))
(ANY "/review-request/:review-request-id" [review-request-id :as request]
View
18 src/docphoto/form.clj
@@ -63,7 +63,22 @@
(if (and (= type :radio)
(not-empty opts))
(for [[label opt-value] opts]
- [:div label (f type attrs name opt-value value) [:br]])
+ [:div
+ (i18n/translate label)
+ (f type attrs name opt-value value) [:br]])
+ (f type attrs name opts value))))
+
+(defn wrap-radio-group-single-line
+ "expand out the radio button options but place on one line"
+ [f]
+ (fn [type attrs name opts value]
+ (if (and (= type :radio-single-line)
+ (not-empty opts))
+ [:div
+ (for [[label opt-value] opts]
+ [:span {:class (:class attrs)}
+ (f :radio attrs name opt-value value)
+ (i18n/translate label)])]
(f type attrs name opts value))))
(defn wrap-select
@@ -79,6 +94,7 @@
(def base-field-render-fn
(-> html4-fields
+ wrap-radio-group-single-line
wrap-radio-group
wrap-checkbox-opts-normalize
wrap-select
View
21 src/docphoto/i18n.clj
@@ -220,6 +220,27 @@ To reset your password, please click on the following link:
:submitted "Submitted" "представленный"
+ :pg-english-language-proficiency
+ "English Language Proficiency"
+ "Владения английским языком"
+
+ :pg-russian-language-proficiency
+ "Russian Language Proficiency"
+ "Русский языком"
+
+ :pg-additional-language-proficiency
+ "Additional Language Proficiency"
+ "Дополнительная языку"
+
+ :beginner "Beginner" "начинающий"
+ :intermediate "Intermediate" "промежуточный"
+ :advanced "Advanced" "передовой"
+ :fluent "Fluent" "беглый"
+
+ :pg-additional-language-proficiency-description
+ "Please list any additional languages you speak, and your proficiency level (Beginner, Intermediate, Advanced, or Fluent):"
+ "Пожалуйста, перечислите любую дополнительную языках вы говорите, и ваш уровень мастерства (начальный, средний, продвинутый или свободный):"
+
:guidelines-prodgrant2012
(:en (guidelines/guidelines :prodgrant2012))
(:ru (guidelines/guidelines :prodgrant2012))
View
8 src/docphoto/salesforce.clj
@@ -213,7 +213,9 @@
(limit-map-field :mailingPostalCode 20)))
(defn prepare-application-fields [app]
- (limit-map-field app :multimedia_Link__c 255))
+ (-> app
+ (limit-map-field :multimedia_Link__c 255)
+ (limit-map-field :additional_language_proficiency__c 255)))
(defcreate create-contact add-owner [contact-data-map]
(Contact.)
@@ -230,7 +232,9 @@
[:statementRich__c :title__c :biography__c :website__c :narrative__c
:contact__c :exhibit__c :submission_Status__c :referredby__c
:multimedia_Link__c :cover_Page__c
- :focus_Region__c :focus_Country_Single_Select__c])))
+ :focus_Region__c :focus_Country_Single_Select__c
+ :english_language_proficiency__c :russian_language_proficiency__c
+ :additional_language_proficiency__c])))
(defcreate create-image no-owner [image-map]
(Image__c.)

No commit comments for this range

Something went wrong with that request. Please try again.