-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in the UI for comment editing (#1102)
* Right now everything returns false in mustache so no one will see it... until those identifiers match true in dev * Using some different colors... those are handled by the pre-fab `btn-` classes. * Utilize the *bootstrap* `hidden-xs` class to only show *font-awesome* in small viewports * ~~One warning added of possible duplicate code added... when more solid on this it will get removed... one way or the other.~~ removed entire code content within `WARNING` blocks in b9e37b4 * Approximated the `editLib` usage between a combination of the other two existing... this could probably use some tuning. * Added a field to the Comment model to handle `edited` based off naming in other models **NOTES** Quoting here from the mastah *(@sizzlemctwizzle)*... > I'd be much more happy to do the backend changes for #601 if I knew the frontend UI was just waiting for me. It's awaiting... I'd like to see how this goes backend wise... if it doesn't eventually somewhere down the line I'll probably move from synchronous to asynchronous to get this flowing better... very lengthy process. <img src="https://cloud.githubusercontent.com/assets/114709/25701290/fc326056-3088-11e7-8f32-42c4edd5ac12.png" alt="logged-out" title="Click to enlarge" width="109" height="86" /> <img src="https://cloud.githubusercontent.com/assets/114709/25701299/07443bae-3089-11e7-9cd5-51a888fe2387.png" alt="logged-in" title="Click to enlarge" width="109" height="86" /> <img src="https://cloud.githubusercontent.com/assets/114709/25701307/0ec79920-3089-11e7-9f7f-20fb833134c9.png" alt="logged-in-forceshow" title="Click to enlarge" width="109" height="86" /> <img src="https://cloud.githubusercontent.com/assets/114709/25701593/4ee900ce-308a-11e7-941e-a241c2dfbc4b.png" alt="logged-in-forceshow-fluid" title="Click to enlarge" width="38" height="86" /> Auto-merge for UI approved changes and bug fix/symmetry... need rewiring in the backend.
- Loading branch information
Showing
7 changed files
with
75 additions
and
22 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,35 @@ | ||
'use strict'; | ||
|
||
// Define some pseudo module globals | ||
var isPro = require('../libs/debug').isPro; | ||
var isDev = require('../libs/debug').isDev; | ||
var isDbg = require('../libs/debug').isDbg; | ||
|
||
// | ||
var User = require('../models/user').User; | ||
|
||
// Determine whether content can be edited by a user. | ||
function editable(aModel, aContent, aUser, aCallback) { | ||
// The user must be logged in | ||
if (!aUser) { | ||
return aCallback(false); | ||
} | ||
|
||
// You can't edit yourself #233 | ||
if (aModel.modelName === 'User') { | ||
return aCallback(false); | ||
} | ||
|
||
User.findOne({ | ||
_id: aContent._authorId | ||
}, function (aErr, aAuthor) { | ||
// Content without an author shouldn't exist | ||
if (aErr || !aAuthor) { | ||
return aCallback(false); | ||
} | ||
|
||
// You can only edit content by yourself | ||
aCallback(aAuthor._id == aUser._id); | ||
}); | ||
} | ||
exports.editable = editable; |
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