-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show error-view instead of yellow notification on content loading errors #57
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class=""> | ||
{{#if icon}}<div class="{{icon}}"></div>{{/if}} | ||
<h2>{{{ text }}}</h2> | ||
</div> |
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,79 @@ | ||
/** | ||
* @author Christoph Wurst <christoph@winzerhof-wurst.at> | ||
* | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
define(function(require) { | ||
'use strict'; | ||
|
||
var smileys = [ | ||
':-(', | ||
':-/', | ||
':-\\', | ||
':-|', | ||
':\'-(', | ||
':\'-/', | ||
':\'-\\', | ||
':\'-|' | ||
]; | ||
|
||
function getRandomSmiley() { | ||
return smileys[Math.floor(Math.random() * smileys.length)] | ||
} | ||
|
||
/** | ||
* @param {Folder} folder | ||
* @returns {string} | ||
*/ | ||
function getRandomFolderErrorMessage(folder) { | ||
var folderName = folder.get('name'); | ||
var rawTexts = [ | ||
t('mail', 'Could not load {tag}{name}{endtag}', { | ||
name: folderName | ||
}), | ||
t('mail', 'We couldn’t load {tag}{name}{endtag}', { | ||
name: folderName | ||
}), | ||
t('mail', 'There was a problem loading {tag}{name}{endtag}', { | ||
name: folderName | ||
}) | ||
]; | ||
var texts = _.map(rawTexts, function(text) { | ||
return text.replace('{tag}', '<strong>').replace('{endtag}', '</strong>'); | ||
}); | ||
var text = texts[Math.floor(Math.random() * texts.length)] | ||
return text + ' ' + getRandomSmiley(); | ||
} | ||
|
||
/** | ||
* @returns {string} | ||
*/ | ||
function getRandomMessageErrorMessage() { | ||
var texts = [ | ||
t('mail', 'We couldn’t load your message'), | ||
t('mail', 'Unable to load the desired message'), | ||
t('mail', 'There was a problem loading the message') | ||
]; | ||
var text = texts[Math.floor(Math.random() * texts.length)] | ||
return text + ' ' + getRandomSmiley(); | ||
} | ||
|
||
return { | ||
getRandomFolderErrorMessage: getRandomFolderErrorMessage, | ||
getRandomMessageErrorMessage: getRandomMessageErrorMessage | ||
}; | ||
}); |
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,44 @@ | ||
/** | ||
* @author Christoph Wurst <christoph@winzerhof-wurst.at> | ||
* | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
define(function(require) { | ||
'use strict'; | ||
|
||
var Handlebars = require('handlebars'); | ||
var Marionette = require('marionette'); | ||
var ErrorTemplate = require('text!templates/error.html'); | ||
|
||
var ErrorView = Marionette.ItemView.extend({ | ||
id: 'emptycontent', | ||
className: 'container', | ||
template: Handlebars.compile(ErrorTemplate), | ||
templateHelpers: function() { | ||
return { | ||
text: this.text, | ||
icon: this.icon | ||
}; | ||
}, | ||
initialize: function(options) { | ||
this.text = options.text || t('mail', 'An unknown error occurred'); | ||
this.icon = options.icon || 'icon-mail'; | ||
} | ||
}); | ||
|
||
return ErrorView; | ||
}); |
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 |
---|---|---|
|
@@ -49,7 +49,9 @@ define(function(require) { | |
}); | ||
}); | ||
|
||
folder.set('active', true); | ||
if (folder) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. small bugfix: if the first folder fails loading, |
||
folder.set('active', true); | ||
} | ||
}, | ||
/** | ||
* @returns {undefined} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you trying to bold the folder name here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #57 (comment) :)
If the strong is correctly outputted on the html and still isn't displayed bold, this could be because the strong css value "font-weight" has been reset. If so just use a span and set it in css. Should be enough! ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Riight, we need to add in our CSS:
strong { font-weight: 600; }
@skjnldsv great to see you back here by the way! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix at nextcloud/server#1423
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to see you both! :)