From 4ff068db0a078ec1a440aa6385a23281a6fb4a05 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 3 Aug 2013 18:27:12 -0700 Subject: [PATCH] minor cleanup --- NzbDrone.sln.DotSettings | 27 ++++++++++++++++++- UI/AddSeries/SearchResultView.js | 8 +++--- UI/Cells/FileSizeCell.js | 2 +- UI/Cells/RelativeDateCell.js | 2 +- UI/Config.js | 6 ++--- UI/Handlebars/Helpers/DateTime.js | 2 +- UI/Handlebars/Helpers/Numbers.js | 4 +-- .../Details/SeasonMenu/CollectionView.js | 4 +-- UI/Shared/FormatHelpers.js | 6 ++--- UI/Shared/StringHelpers.js | 26 ++++++++++++------ .../Radio/RadioButtonCollectionView.js | 2 +- UI/Shared/Toolbar/Radio/RadioButtonView.js | 2 +- 12 files changed, 63 insertions(+), 28 deletions(-) diff --git a/NzbDrone.sln.DotSettings b/NzbDrone.sln.DotSettings index 0df34a8ab..a17d31632 100644 --- a/NzbDrone.sln.DotSettings +++ b/NzbDrone.sln.DotSettings @@ -1,4 +1,5 @@  + 0 ERROR DO_NOT_SHOW DO_NOT_SHOW @@ -8,11 +9,30 @@ ERROR HINT HINT + <?xml version="1.0" encoding="utf-16"?><Profile name="NzbDrone"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>IMPLICIT_EXCEPT_SIMPLE_TYPES</LocalVariableStyle><ForeachVariableStyle>ALWAYS_IMPLICIT</ForeachVariableStyle></CSUseVar><CSUpdateFileHeader>True</CSUpdateFileHeader><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReorderTypeMembers>True</CSReorderTypeMembers><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags></Profile> + NzbDrone + True + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + True + True + False + False + False + ON_SINGLE_LINE + False + False + False <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"><ExtraRule Prefix="" Suffix="" Style="AaBb" /></Policy> BOTH_SIDES - OUTLINE + COLOR + True SOLUTION_FOLDER True C:\Dropbox\Git\NzbDrone\NzbDrone.sln.DotSettings @@ -20,6 +40,11 @@ 1 True 2 + False + True + True + True + True Backbone model 5 True diff --git a/UI/AddSeries/SearchResultView.js b/UI/AddSeries/SearchResultView.js index 458318228..de88520cf 100644 --- a/UI/AddSeries/SearchResultView.js +++ b/UI/AddSeries/SearchResultView.js @@ -44,8 +44,8 @@ define( onRender: function () { - var defaultQuality = Config.GetValue(Config.Keys.DefaultQualityProfileId); - var defaultRoot = Config.GetValue(Config.Keys.DefaultRootFolderId); + var defaultQuality = Config.getValue(Config.Keys.DefaultQualityProfileId); + var defaultRoot = Config.getValue(Config.Keys.DefaultRootFolderId); if (QualityProfiles.get(defaultQuality)) { this.ui.qualityProfile.val(defaultQuality); @@ -84,7 +84,7 @@ define( }, _qualityProfileChanged: function () { - Config.SetValue(Config.Keys.DefaultQualityProfileId, this.ui.qualityProfile.val()); + Config.setValue(Config.Keys.DefaultQualityProfileId, this.ui.qualityProfile.val()); }, _rootFolderChanged: function () { @@ -93,7 +93,7 @@ define( App.modalRegion.show(this.rootFolderLayout); } else { - Config.SetValue(Config.Keys.DefaultRootFolderId, rootFolderValue); + Config.setValue(Config.Keys.DefaultRootFolderId, rootFolderValue); } }, diff --git a/UI/Cells/FileSizeCell.js b/UI/Cells/FileSizeCell.js index 58e58bae6..103ad5b2d 100644 --- a/UI/Cells/FileSizeCell.js +++ b/UI/Cells/FileSizeCell.js @@ -11,7 +11,7 @@ define( render: function () { var size = this.model.get(this.column.get('name')); - this.$el.html(FormatHelpers.Bytes(size)); + this.$el.html(FormatHelpers.bytes(size)); this.delegateEvents(); return this; } diff --git a/UI/Cells/RelativeDateCell.js b/UI/Cells/RelativeDateCell.js index c411a731e..4f8eb8a30 100644 --- a/UI/Cells/RelativeDateCell.js +++ b/UI/Cells/RelativeDateCell.js @@ -14,7 +14,7 @@ define( var date = this.model.get(this.column.get('name')); if (date) { - this.$el.html("" + FormatHelpers.DateHelper(date) + "" + FormatHelpers.dateHelper(date) + " [{1}] '.format(key, value)); - if (this.GetValue(key) === value.toString()) { + if (this.getValue(key) === value.toString()) { return; } diff --git a/UI/Handlebars/Helpers/DateTime.js b/UI/Handlebars/Helpers/DateTime.js index ac61cb63d..0f8082ccb 100644 --- a/UI/Handlebars/Helpers/DateTime.js +++ b/UI/Handlebars/Helpers/DateTime.js @@ -22,7 +22,7 @@ define( } var date = Moment(input); - var result = '' + FormatHelpers.DateHelper(input) + ''; + var result = '' + FormatHelpers.dateHelper(input) + ''; return new Handlebars.SafeString(result); }); diff --git a/UI/Handlebars/Helpers/Numbers.js b/UI/Handlebars/Helpers/Numbers.js index 44443fc34..f90cef4cb 100644 --- a/UI/Handlebars/Helpers/Numbers.js +++ b/UI/Handlebars/Helpers/Numbers.js @@ -5,7 +5,7 @@ define( 'Shared/FormatHelpers' ], function (Handlebars, FormatHelpers) { Handlebars.registerHelper('Bytes', function (size) { - return new Handlebars.SafeString(FormatHelpers.Bytes(size)); + return new Handlebars.SafeString(FormatHelpers.bytes(size)); }); Handlebars.registerHelper('Pad2', function (input) { @@ -13,7 +13,7 @@ define( }); Handlebars.registerHelper('Number', function (input) { - return FormatHelpers.Number(input); + return FormatHelpers.number(input); }); }); diff --git a/UI/Series/Details/SeasonMenu/CollectionView.js b/UI/Series/Details/SeasonMenu/CollectionView.js index f7dd0544a..32cfafd60 100644 --- a/UI/Series/Details/SeasonMenu/CollectionView.js +++ b/UI/Series/Details/SeasonMenu/CollectionView.js @@ -19,11 +19,11 @@ define( itemViewOptions: function () { return { - episodeCollection: this.episodeCollection, + episodeCollection: this.episodeCollection }; }, - appendHtml: function(collectionView, itemView, index){ + appendHtml: function(collectionView, itemView){ var childrenContainer = $(collectionView.childrenContainer || collectionView.el); childrenContainer.prepend(itemView.el); } diff --git a/UI/Shared/FormatHelpers.js b/UI/Shared/FormatHelpers.js index 835f3e9c0..c29e1606a 100644 --- a/UI/Shared/FormatHelpers.js +++ b/UI/Shared/FormatHelpers.js @@ -8,12 +8,12 @@ define( return { - Bytes: function (sourceSize) { + bytes: function (sourceSize) { var size = Number(sourceSize); return Filesize(size, 1, false); }, - DateHelper: function (sourceDate) { + dateHelper: function (sourceDate) { if (!sourceDate) { return ''; } @@ -46,7 +46,7 @@ define( return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; }, - Number: function (input) { + number: function (input) { if (!input) { return ''; } diff --git a/UI/Shared/StringHelpers.js b/UI/Shared/StringHelpers.js index 89f5e3ff8..e5fafb55a 100644 --- a/UI/Shared/StringHelpers.js +++ b/UI/Shared/StringHelpers.js @@ -6,17 +6,27 @@ define( return { - startsWith: function(str, starts){ - if (starts === '') return true; - if (str == null || starts == null) return false; - str = String(str); starts = String(starts); + startsWith: function (str, starts) { + if (starts === '') { + return true; + } + if (str == null || starts == null) { + return false; + } + str = String(str); + starts = String(starts); return str.length >= starts.length && str.slice(0, starts.length) === starts; }, - endsWith: function(str, ends){ - if (ends === '') return true; - if (str == null || ends == null) return false; - str = String(str); ends = String(ends); + endsWith: function (str, ends) { + if (ends === '') { + return true; + } + if (str == null || ends == null) { + return false; + } + str = String(str); + ends = String(ends); return str.length >= ends.length && str.slice(str.length - ends.length) === ends; } } diff --git a/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js b/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js index cded0aba1..240cd1445 100644 --- a/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js +++ b/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js @@ -22,7 +22,7 @@ define( }, setActive: function () { - var storedKey = Config.GetValue(this.menu.menuKey, this.menu.defaultAction); + var storedKey = Config.getValue(this.menu.menuKey, this.menu.defaultAction); this.collection.each(function (model) { if (model.get('key').toLocaleLowerCase() === storedKey.toLowerCase()) { diff --git a/UI/Shared/Toolbar/Radio/RadioButtonView.js b/UI/Shared/Toolbar/Radio/RadioButtonView.js index 7e301931c..3f5be2a6f 100644 --- a/UI/Shared/Toolbar/Radio/RadioButtonView.js +++ b/UI/Shared/Toolbar/Radio/RadioButtonView.js @@ -37,7 +37,7 @@ define( onClick: function () { - Config.SetValue(this.model.get('menuKey'), this.model.get('key')); + Config.setValue(this.model.get('menuKey'), this.model.get('key')); this.invokeCallback(); },