Skip to content

Commit

Permalink
dropping the Region suffix from regions:{}
Browse files Browse the repository at this point in the history
  • Loading branch information
MeoMix committed May 16, 2015
1 parent 02d8f8b commit 3c16b89
Show file tree
Hide file tree
Showing 26 changed files with 136 additions and 138 deletions.
5 changes: 2 additions & 3 deletions src/js/background/view/backgroundAreaView.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@

regions: function(options) {
return {
youTubePlayerRegion: {
youTubePlayer: {
el: '[data-region=youTubePlayer]',
regionClass: YouTubePlayerRegion,
// TODO: feels weird to need to do this... all other regions aren't functions
youTubePlayer: options.model.get('youTubePlayer')
},
clipboardRegion: {
clipboard: {
el: '[data-region=clipboard]',
regionClass: ClipboardRegion
}
Expand Down
26 changes: 13 additions & 13 deletions src/js/foreground/view/appBar/appBarView.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
},

regions: {
playlistTitleRegion: '[data-region=playlistTitle]',
volumeAreaRegion: '[data-region=volumeArea]',
adminMenuAreaRegion: '[data-region=adminMenuArea]',
previousButtonRegion: '[data-region=previousButton]',
playPauseButtonRegion: '[data-region=playPauseButton]',
nextButtonRegion: '[data-region=nextButton]'
playlistTitle: '[data-region=playlistTitle]',
volumeArea: '[data-region=volumeArea]',
adminMenuArea: '[data-region=adminMenuArea]',
previousButton: '[data-region=previousButton]',
playPauseButton: '[data-region=playPauseButton]',
nextButton: '[data-region=nextButton]'
},

ui: {
Expand Down Expand Up @@ -94,25 +94,25 @@
this._setPlaylistTitleRegion(signedInUser);
}

this.showChildView('volumeAreaRegion', new VolumeAreaView({
this.showChildView('volumeArea', new VolumeAreaView({
player: Streamus.backgroundPage.player
}));

this.showChildView('adminMenuAreaRegion', new AdminMenuAreaView({
this.showChildView('adminMenuArea', new AdminMenuAreaView({
model: new AdminMenuArea(),
tabManager: Streamus.backgroundPage.tabManager
}));

this.showChildView('previousButtonRegion', new PreviousButtonView({
this.showChildView('previousButton', new PreviousButtonView({
model: Streamus.backgroundPage.previousButton
}));

this.showChildView('playPauseButtonRegion', new PlayPauseButtonView({
this.showChildView('playPauseButton', new PlayPauseButtonView({
model: Streamus.backgroundPage.playPauseButton,
player: Streamus.backgroundPage.player
}));

this.showChildView('nextButtonRegion', new NextButtonView({
this.showChildView('nextButton', new NextButtonView({
model: Streamus.backgroundPage.nextButton
}));
},
Expand Down Expand Up @@ -141,7 +141,7 @@

_onPlaylistsChangeActive: function(model, active) {
if (active) {
this.showChildView('playlistTitleRegion', new PlaylistTitleView({
this.showChildView('playlistTitle', new PlaylistTitleView({
model: model
}));
}
Expand Down Expand Up @@ -202,7 +202,7 @@
},

_setPlaylistTitleRegion: function(signedInUser) {
this.showChildView('playlistTitleRegion', new PlaylistTitleView({
this.showChildView('playlistTitle', new PlaylistTitleView({
model: signedInUser.get('playlists').getActivePlaylist()
}));
},
Expand Down
7 changes: 4 additions & 3 deletions src/js/foreground/view/behavior/itemViewMultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
this.ui.leftContent.addClass('is-showingCheckbox');
this.ui.leftContent.removeClass('is-showingThumbnail');

this.view.showChildView('checkboxRegion', new CheckboxView({
this.view.showChildView('checkbox', new CheckboxView({
model: this.checkbox
}));
}
Expand All @@ -69,7 +69,8 @@
this.ui.leftContent.removeClass('is-showingCheckbox');
this.ui.leftContent.addClass('is-showingThumbnail');

this.view.checkboxRegion.empty();
// TODO: Change to getChildView
this.view.checkbox.empty();
}
},

Expand All @@ -86,7 +87,7 @@
this.ui.leftContent.toggleClass('is-showingThumbnail', !selected);

if (selected) {
this.view.showChildView('checkboxRegion', new CheckboxView({
this.view.showChildView('checkbox', new CheckboxView({
model: this.checkbox
}));
}
Expand Down
4 changes: 2 additions & 2 deletions src/js/foreground/view/behavior/slidingRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@

if (translateY !== this.childContainerTranslateY) {
this.childContainerTranslateY = translateY;
this.ui.childContainer.css('transform', 'translateY(' + translateY + 'px)');
this.ui.listItems.css('transform', 'translateY(' + translateY + 'px)');
}
},

Expand All @@ -228,7 +228,7 @@

if (height !== this.childContainerHeight) {
this.childContainerHeight = height;
this.ui.childContainer.height(height);
this.ui.listItems.height(height);
}
},

Expand Down
16 changes: 8 additions & 8 deletions src/js/foreground/view/behavior/sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
if (!this.isDecorated) {
this.isDecorated = true;

this.ui.childContainer.sortable(this._getSortableOptions());
this.ui.listItems.sortable(this._getSortableOptions());

this.$el.scroll(_.throttle(function() {
// Any function which is throttled can potentially be ran after the view is destroyed.
if (!this.view.isDestroyed) {
this.ui.childContainer.sortable('refresh');
this.ui.listItems.sortable('refresh');
}
}.bind(this), 20));
}
Expand Down Expand Up @@ -88,7 +88,7 @@

$('.' + this.placeholderClass).toggleClass('is-hidden', placeholderAdjacent);

this.ui.childContainer.sortable('refresh');
this.ui.listItems.sortable('refresh');

// Hiding or removing the placeholder modifies the height of the child container which can cause a scrollbar to appear/disappear. So, need to notify.
this.view.triggerMethod('UpdateScrollbar');
Expand All @@ -109,7 +109,7 @@
return item.get('song');
});

this.ui.childContainer.addClass(this.isDraggingClass).data({
this.ui.listItems.addClass(this.isDraggingClass).data({
draggedSongs: draggedSongs
});

Expand All @@ -119,7 +119,7 @@
// Placeholder stops being accessible once beforeStop finishes, so store its index here for use later.
_beforeStop: function(event, ui) {
// Subtract one from placeholderIndex when parentNode exists because jQuery UI moves the HTML element above the placeholder.
this.ui.childContainer.data({
this.ui.listItems.data({
placeholderIndex: ui.placeholder.index() - 1
});
},
Expand All @@ -130,10 +130,10 @@
// TODO: Check collection isImmutable instead of ListItemType.
// The SearchResult view is not able to be moved so disable move logic for it.
// If the mouse dropped the items not over the given list don't run move logic.
var allowMove = ui.item.data('type') !== ListItemType.SearchResult && this.ui.childContainer.is(':hover');
var allowMove = ui.item.data('type') !== ListItemType.SearchResult && this.ui.listItems.is(':hover');
if (allowMove) {
this.view.once('GetMinRenderIndexResponse', function(response) {
var dropIndex = this.ui.childContainer.data('placeholderIndex') + response.minRenderIndex;
var dropIndex = this.ui.listItems.data('placeholderIndex') + response.minRenderIndex;
this._moveItems(this.view.collection.selected(), dropIndex, isParentNodeLost);
this._cleanup();
}.bind(this));
Expand All @@ -149,7 +149,7 @@
},

_cleanup: function() {
this.ui.childContainer.removeData('draggedSongs placeholderIndex').removeClass(this.isDraggingClass);
this.ui.listItems.removeData('draggedSongs placeholderIndex').removeClass(this.isDraggingClass);
Streamus.channels.element.vent.trigger('drop');
},

Expand Down
13 changes: 7 additions & 6 deletions src/js/foreground/view/dialog/browserSettingsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
},

regions: {
showTextSelectionContextMenuRegion: '[data-region=showTextSelectionContextMenu]',
showYouTubeLinkContextMenuRegion: '[data-region=showYouTubeLinkContextMenu]',
showYouTubePageContextMenuRegion: '[data-region=showYouTubePageContextMenu]',
enhanceYouTubeRegion: '[data-region=enhanceYouTube]',
enhanceBeatportRegion: '[data-region=enhanceBeatport]'
showTextSelectionContextMenu: '[data-region=showTextSelectionContextMenu]',
showYouTubeLinkContextMenu: '[data-region=showYouTubeLinkContextMenu]',
showYouTubePageContextMenu: '[data-region=showYouTubePageContextMenu]',
enhanceYouTube: '[data-region=enhanceYouTube]',
enhanceBeatport: '[data-region=enhanceBeatport]'
},

initialize: function() {
Expand Down Expand Up @@ -52,7 +52,8 @@
property: propertyName
});

this[propertyName + 'Region'].show(new CheckboxView({
// TODO: Change to getChildView
this[propertyName].show(new CheckboxView({
model: checkbox
}));
}
Expand Down
8 changes: 4 additions & 4 deletions src/js/foreground/view/dialog/dialogView.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
contentView: null,

regions: {
reminderRegion: '[data-region=reminder]',
contentRegion: '[data-region=content]'
reminder: '[data-region=reminder]',
content: '[data-region=content]'
},

ui: {
Expand Down Expand Up @@ -43,7 +43,7 @@
},

onRender: function() {
this.showChildView('contentRegion', this.contentView);
this.showChildView('content', this.contentView);

if (this.model.hasReminder()) {
this._showReminder();
Expand Down Expand Up @@ -137,7 +137,7 @@
iconOnLeft: true
});

this.showChildView('reminderRegion', new CheckboxView({
this.showChildView('reminder', new CheckboxView({
model: this.reminderCheckbox
}));
},
Expand Down
4 changes: 2 additions & 2 deletions src/js/foreground/view/dialog/exportPlaylistView.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},

regions: {
fileTypeRegion: '[data-region=fileType]'
fileType: '[data-region=fileType]'
},

radioGroups: null,
Expand Down Expand Up @@ -52,7 +52,7 @@
});

// TODO: Change to showChildView
this[propertyName + 'Region'].show(new RadioGroupView({
this[propertyName].show(new RadioGroupView({
model: radioGroup,
collection: radioGroup.get('buttons')
}));
Expand Down
26 changes: 13 additions & 13 deletions src/js/foreground/view/dialog/settingsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
},

regions: {
songQualityRegion: '[data-region=songQuality]',
openToSearchRegion: '[data-region=openToSearch]',
openInTabRegion: '[data-region=openInTab]',
remindClearStreamRegion: '[data-region=remindClearStream]',
remindDeletePlaylistRegion: '[data-region=remindDeletePlaylist]',
remindLinkAccountRegion: '[data-region=remindLinkAccount]',
remindGoogleSignInRegion: '[data-region=remindGoogleSignIn]',
desktopNotificationsEnabledRegion: '[data-region=desktopNotificationsEnabled]',
desktopNotificationDurationRegion: '[data-region=desktopNotificationDuration]'
songQuality: '[data-region=songQuality]',
openToSearch: '[data-region=openToSearch]',
openInTab: '[data-region=openInTab]',
remindClearStream: '[data-region=remindClearStream]',
remindDeletePlaylist: '[data-region=remindDeletePlaylist]',
remindLinkAccount: '[data-region=remindLinkAccount]',
remindGoogleSignIn: '[data-region=remindGoogleSignIn]',
desktopNotificationsEnabled: '[data-region=desktopNotificationsEnabled]',
desktopNotificationDuration: '[data-region=desktopNotificationDuration]'
},

checkboxes: null,
Expand Down Expand Up @@ -92,7 +92,7 @@
});

// TODO: Change to showChildView
this[propertyName + 'Region'].show(new SimpleListItemView({
this[propertyName].show(new SimpleListItemView({
model: simpleListItem
}));
},
Expand All @@ -112,7 +112,7 @@
});

// TODO: Change to showChildView
this[propertyName + 'Region'].show(new RadioGroupView({
this[propertyName].show(new RadioGroupView({
model: radioGroup,
collection: radioGroup.get('buttons')
}));
Expand All @@ -126,7 +126,7 @@
});

// TODO: Change to showChildView
this[propertyName + 'Region'].show(new CheckboxView({
this[propertyName].show(new CheckboxView({
model: checkbox
}));
},
Expand All @@ -140,7 +140,7 @@
});

// TODO: Change to showChildView
this[propertyName + 'Region'].show(new SwitchView({
this[propertyName].show(new SwitchView({
model: switchModel
}));
},
Expand Down
6 changes: 3 additions & 3 deletions src/js/foreground/view/element/simpleListItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},

regions: {
simpleMenuRegion: '[data-region=simpleMenu]'
simpleMenu: '[data-region=simpleMenu]'
},

ui: {
Expand Down Expand Up @@ -54,7 +54,7 @@

_openSimpleMenu: function() {
// If the list item is clicked while the menu is open do not re-open it.
if (_.isUndefined(this.getChildView('simpleMenuRegion'))) {
if (_.isUndefined(this.getChildView('simpleMenu'))) {
var options = this.model.get('options');
var simpleMenuItems = new SimpleMenuItems(_.map(options, function(option) {
return {
Expand All @@ -67,7 +67,7 @@
// Since I'm building this inside of a click event and click events can close the menu I need to let the event finish before showing the menu
// otherwise it'll close immediately.
_.defer(function() {
this.showChildView('simpleMenuRegion', new SimpleMenuView({
this.showChildView('simpleMenu', new SimpleMenuView({
simpleMenuItems: simpleMenuItems,
model: new SimpleMenu(),
listItemHeight: this.$el.height()
Expand Down

0 comments on commit 3c16b89

Please sign in to comment.