forked from TracksApp/tracks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating preferences on user and prefs model work. also add date_form…
…at picker
- Loading branch information
Showing
12 changed files
with
750 additions
and
815 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
class PreferencesController < ApplicationController | ||
|
||
def index | ||
@page_title = t('preferences.page_title') | ||
@prefs = current_user.prefs | ||
@user = current_user | ||
end | ||
|
||
def edit | ||
@page_title = t('preferences.page_title_edit') | ||
@prefs = current_user.prefs | ||
end | ||
|
||
def update | ||
@prefs = current_user.prefs | ||
@user = current_user | ||
user_updated = current_user.update_attributes(params['user']) | ||
prefs_updated = current_user.preference.update_attributes(params['prefs']) | ||
if user_updated && prefs_updated | ||
if (user_updated && prefs_updated) | ||
notify :notice, "Preferences updated" | ||
redirect_to :action => 'index' | ||
else | ||
render :action => 'edit' | ||
msg = "Preferences could not be updated: " | ||
msg += "User model errors; " unless user_updated | ||
msg += "Prefs model errors; " unless prefs_updated | ||
notify :warning, msg | ||
render 'index' | ||
end | ||
end | ||
|
||
|
||
def render_date_format | ||
format = params[:date_format] | ||
render :text => l(Date.today, :format => format) | ||
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
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.