Created
July 21, 2009 14:13
-
-
Save Dishwasha/151347 to your computer and use it in GitHub Desktop.
This file contains 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 create | |
@alert = current_user.alerts.build params[:alert] | |
if params[:send] | |
@alert.save | |
@alert.deliver | |
flash[:notice] = "Successfully sent the alert" | |
redirect_to logs_path | |
else | |
render :template => "alerts/preview" | |
end | |
end | |
def edit | |
alert = current_user.alerts.find params[:id] | |
@alert = present alert, :action => params[:_action] | |
render :template => "alerts/edit_with_#{params[:_action]}" | |
end | |
def cancel | |
@alert = current_user.alerts.find params[:id] | |
#original_alert = current_user.alerts.find params[:id] | |
#@alert = original_alert.build_cancellation params[:alert] | |
if params[:send] | |
#@alert.save | |
#@alert.deliver | |
flash[:notice] = "Successfully sent the alert" | |
redirect_to logs_path | |
else | |
render :template => "alerts/edit_with_cancel" | |
end | |
end |
This file contains 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
<% form_for @alert, :url => cancel_alert_path(@alert.original_alert.nil? ? @alert : @alert.original_alert) do |form| %> | |
<div id="edit"> | |
<%= render form %> | |
<%= form.submit "Preview Message" %> | |
</div> | |
<div id="preview"> | |
<%= render @alert %> | |
<%= link_to 'Edit', '#edit', :class => 'edit' %> | |
<%= form.submit "Send", :name => 'send' %> | |
</div> | |
<% end %> |
This file contains 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
map.resources :user_profiles, :as => "profile" | |
map.resources :jurisdictions | |
map.resources :role_requests, :controller => "role_requests" | |
map.resources :admin_role_requests, :member => [:approve, :deny], :controller => "admin/role_requests" | |
map.resources :admin_organizations, :member => [:approve, :deny], :controller => "admin/organizations" | |
map.resources :users, :collection => {:search => :get} do |user| | |
user.resource :user_profile, :as => "profile" | |
user.confirmation "/confirm/:token", :controller => "users", :action => "confirm" | |
end | |
map.resources :alerts, :member => { :cancel => [:post,:put]} | |
map.resources :roles | |
map.resources :logs | |
map.resources :organizations | |
map.dashboard "/dashboard", :controller => "dashboard", :action => "index" | |
map.root :controller => "dashboard", :action => "index" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment