This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TermsAndCondition < ActiveRecord::Base | |
| include CommonScopes | |
| include CheckBannedWords | |
| include ReachRoleExtensions | |
| belongs_to :program | |
| has_reach | |
| has_paper_trail | |
| is_hierarchable | |
| is_dynamically_translatable title: { required: true }, content: { required: true }, mcf_content: { required: false }, accept_text: { required: true }, decline_text: { required: true }, decline_message: { required: true } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def send_custom_email email, email_translation, recipient, context_variables | |
| # ... | |
| fields = %w|{{user.first_name}} {{user.last_name}} {{user.username}} {{user.site_name}} | |
| {{initiative.name}} {{initiative_methodology.name}} {{user_award.points}} {{user_award.disbursed_at}} | |
| {{user_award.reason}} {{user_award.message}} {{user_award.link}} {{file_upload_job.status}}| | |
| if recipient.present? | |
| fields.each do |f| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Refinery::Core::Engine.routes.draw do | |
| # Frontend routes | |
| resources :core_topics do | |
| namespace :articles, :path => '/articles' do | |
| resources :articles, :path => '', :only => [:index, :show] | |
| end | |
| end | |
| # Admin routes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| var SubmissionForm = { | |
| edit_link: "/find_submission_option_contents", | |
| edit_option_link: "/find_submission_option_settings", | |
| save_sort_url: "/save_submission_sort", | |
| finished_content: false, | |
| finished_type: false, | |
| current_locale: $("#meth_locale").val(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def can_upload_awards? | |
| self.secondary_roles.each do |role| | |
| return true if role.can_upload_awards? | |
| end | |
| false | |
| end | |
| def can_shop? | |
| self.secondary_roles.each do |role| | |
| return true if role.can_shop? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def can_receive_award_according_to_restrictions? user, award | |
| remaining_restriction_points(user) >= award[:points].to_i && | |
| remaining_restriction_game_tokens(user) >= award[:game_tokens].to_i && | |
| remaining_restriction_gift_tokens(user) >= award[:gift_tokens].to_i | |
| end | |
| currencies = ["points", "game_tokens", "gift_tokens"] | |
| currencies.each do |currency| | |
| define_method "remaining_restriction_#{currency}" do |user| | |
| currency_points = find_currency_of_submissions(user, currency) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def equalization_steps(a) | |
| array, steps = a, 0 | |
| begin | |
| a.each_with_index do |v, i| | |
| if v > a[ (i + 1) % a.length ] | |
| array[i] -= 1 | |
| else | |
| array[i] += 1 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def heavy_decimal_count(a, b) | |
| total = 0 | |
| (a..b).each do |value| | |
| values = value.to_s.split('') | |
| array_size = values.size | |
| if (values.map(&:to_i).inject{|sum,n| sum += n }.to_f / array_size.to_f) > 7.0 | |
| total += 1 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% page = Refinery::Page.find_by_path("about") %> | |
| <ul> | |
| <% page.children.each_with_index do |child, i| %> | |
| <li> | |
| <%= image_tag(asset_path("hex-#{i + 1}.png")) %> | |
| </li> | |
| <% end if page.children %> | |
| </ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SlideShow = | |
| current_image: 0, | |
| max_images: 0, | |
| init: -> | |
| $slideshow = $('#slideshow > div ul') | |
| $slideshow.find('li').hide().eq(0).show() | |
| this.max_images = $slideshow.find('li').length | |
| @changeSlide($slideshow) |