-
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.
Conversation marking feature written, all specs passing.
- Loading branch information
Showing
22 changed files
with
274 additions
and
148 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
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 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 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module NightTrain | ||
class MessagesController < NightTrain::ApplicationController | ||
before_filter :load_message | ||
|
||
# GET /box/in/messages/1 | ||
def show | ||
respond_to do |format| | ||
format.json { render :show } | ||
end | ||
end | ||
|
||
# PATCH/PUT /box/in/messages/1 | ||
def update | ||
if params[:mark_to_set].present? | ||
@box.mark params[:mark_to_set], @message | ||
end | ||
respond_to_marking | ||
end | ||
|
||
private | ||
|
||
def load_message | ||
@message = @box.find_message(params[:id]) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module NightTrain | ||
module MessagesHelper | ||
def message_class(box, message) | ||
css_classes = [] | ||
|
||
if message.is_unread_for?(@box.parent) | ||
css_classes << 'unread' | ||
else | ||
css_classes << 'read' | ||
end | ||
|
||
if message.draft | ||
css_classes << 'draft' | ||
end | ||
|
||
if box.division == :trash | ||
unless message.is_trashed_for?(box.parent) | ||
css_classes << 'hide' | ||
end | ||
else | ||
unless message.is_untrashed_for?(box.parent) | ||
css_classes << 'hide' | ||
end | ||
end | ||
css_classes.join(' ') | ||
end | ||
|
||
def message_trashed_toggle(message) | ||
render partial: 'night_train/messages/trashed_toggle', locals: { message: message } | ||
end | ||
|
||
def message_read_toggle(message) | ||
render partial: 'night_train/messages/read_toggle', locals: { message: message } | ||
end | ||
|
||
def message_deleted_toggle(message) | ||
render partial: 'night_train/messages/deleted_toggle', locals: { message: message } | ||
end | ||
|
||
def message_toggle(message, icon, mark_to_set, title, options = {}) | ||
options[:remote] = true | ||
options[:id] = "mark_#{mark_to_set}_#{message.id}" | ||
options[:method] = :put | ||
options[:title] = title | ||
render partial: 'night_train/messages/toggle', locals: { | ||
message: message, | ||
icon: icon, | ||
mark_to_set: mark_to_set, | ||
options: options | ||
} | ||
end | ||
end | ||
end |
Oops, something went wrong.