Skip to content

Commit

Permalink
tweak bootstrap dtp
Browse files Browse the repository at this point in the history
  • Loading branch information
stevedowney committed Jun 2, 2013
1 parent 1b206cd commit fb5dd12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/helpers/user_announcements/misc_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def ua_bootstrap?
end

def ua_bootstrap_datetime_picker?
ua_bootstrap? && UserAnnouncements[:bootstrap_datetime_picker]
return false unless ua_bootstrap?
return true if params[:bootstrap] == 'true'
UserAnnouncements[:bootstrap_datetime_picker]
end
end
10 changes: 10 additions & 0 deletions spec/helpers/user_announcements/misc_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
before { @_config_dtp = UserAnnouncements[:bootstrap_datetime_picker] }
after { UserAnnouncements.config.bootstrap = @_config_dtp }

it "true if params[:bootstrap] is true" do
UserAnnouncements.config.bootstrap = false
UserAnnouncements.config.bootstrap_datetime_picker = false
helper.stub(params: {bootstrap: 'true'})
helper.should be_ua_bootstrap_datetime_picker

helper.stub(params: {bootstrap: 'false'})
helper.should_not be_ua_bootstrap_datetime_picker
end

it "true if config true" do
UserAnnouncements.config.bootstrap = true
UserAnnouncements.config.bootstrap_datetime_picker = true
Expand Down

0 comments on commit fb5dd12

Please sign in to comment.