diff --git a/_working/event.sql b/_working/event.sql deleted file mode 100644 index 1b5379a..0000000 --- a/_working/event.sql +++ /dev/null @@ -1,35 +0,0 @@ -LOCK TABLES `spa_event` WRITE; -DELETE FROM `spa_event`; -/*!40000 ALTER TABLE `spa_event` DISABLE KEYS */; -INSERT INTO `spa_event` VALUES (1,1,'2012-08-31','22:00:00','2012-08-15','Go Deep','\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\"Fish \r\n

Deep soulful house with - Greg and Shane on that Bozak mixer. All sorts of disco deviancy, soul explorations and rhythmic revelations

\r\n

Visit the artists website:

\r\n< -p style=\"margin: 0px; padding: 0px 0px 10px; border: 0px; font-size: 11px; font-family: \'Lucida Grande\', Arial, Helvetica, sans-serif; vertical-align: bas -eline; color: #ffffff; line-height: 15.383333206176758px;\">www.fishgod -eep.com

\r\n

 

\r\n

&n -bsp;

\r\n
',3),(2,1,'2012-08-15','12:06:31','2012-08-15','The Crucial Party','\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\"The\r\n

A Cosmic Carousel of Sights and Sounds… “Sometime -s in life you just got to Party”.

\r\n

Bored with the same old routine? -Looking for a new night out? Then fret not folks, this could be the solution to all your problems.
The Crucial party is here to save your Soul, bring yo -u closer to your inner child, make you shake like shakira and smile like a beauty queen.We feel that it’s time for a revolution,a dancing revolution, a - social revolution,a visual revolution. So we say “Let’s make Party. Lets make Good Times”  and you say “Yes we can can&rdq -uo;.
Every saturday the Crucial Party will be a culture club full of eye candy and stage axe, jukebox jugglers & visual attacks,poptastical tre -ats from 60’s to new beats.
Music for Young Guns, Soul sista’s, Jazzy bro’s and Groovy twisters.
But this is not just about the t -unes,we feel we can touch you in places never touched before.

\r\n

We feel It -just might be  what you are needing. Karma For the People from under the steeple.
Its a Hot-pot of Lovers Rocking, Afro Poppin’, Turbo Boogie - , Slam Dunk Funk,
Jezebels & Jokers, Soothsayers, Rebel city Playa’s and City Folk.

\r\n

Then it might be time to move your body to the rhythm of love and come join us at the Pav every saturday. So get on down to party -down. 

\r\n

 

\r\n
',2); -/*!40000 ALTER TABLE `spa_event` ENABLE KEYS */; -UNLOCK TABLES; - diff --git a/_working/label.sql b/_working/label.sql deleted file mode 100644 index 7d11985..0000000 --- a/_working/label.sql +++ /dev/null @@ -1,6 +0,0 @@ -LOCK TABLES `spa_label` WRITE; -/*!40000 ALTER TABLE `spa_label` DISABLE KEYS */; -DELETE FROM `spa_label`; -INSERT INTO `spa_label` VALUES (1,'Test Label 1'),(2,'BEEF Recordings'),(3,'Rauschzeit'),(4,'Lost My Dog'); -/*!40000 ALTER TABLE `spa_label` ENABLE KEYS */; -UNLOCK TABLES; diff --git a/_working/mix.sql b/_working/mix.sql deleted file mode 100644 index d1cdbd6..0000000 --- a/_working/mix.sql +++ /dev/null @@ -1,6 +0,0 @@ -LOCK TABLES `spa_mix` WRITE; -DELETE FROM `spa_mix`; -/*!40000 ALTER TABLE `spa_mix` DISABLE KEYS */; -INSERT INTO `spa_mix` VALUES (1,'June 2010','Marbert Rocell - Beats Like Birds\r\nMoto Clara - Silently\r\nBroad Bean Band - OkiDoki (Fish Go Deep Mix)\r\nJay Shepheard - Umzug\r\nThe Juan MacLean - Happy House\r\nScope - Runnin\' The Game\r\nJayson Brothers - The Game\r\nSezer Uysal & Everen Ulosoy - Singing In The Bathtub\r\nLatour - Blue\r\nPol_On - Toga\r\nArmando - Don\'t Take It\r\nDaniel Paul - Outta Space\r\nFlight Facilities feat Giselle - Crave You\r\nPhonique feat Erlend Oye - Casualties (Morgan Geist remix)','2012-04-17 17:46:26','mix-images/fergalmoran/crazymix.jpg','mixes/June2010.mp3','mixes/June2010.mp3','mixes/June2010.mp3',1,1),(9,'Andre Lodemann \"Fragments\"','01. Latecomer - Cosmic Cart - Faces Records\r\n02. Andre Lodemann - Going To The Core feat. Nathalie Claude - BWR\r\n03. Prommer & Barck - Sleeping Beauty (Broken Reform Rmx) - Derwin\r\n04. Franck Roger - Hustling Peoples - Real Tone\r\n05. Acos Coolkas - Dont Fly Away (Jimpster Dub) - Audio Tonic\r\n06. Manuel Tur - About To Fall - Mild Pitch\r\n07. Kevin Saunderson feat. Inner City - Future (Kenny Larkin Tension Mix) AL Edit\r\n08. Paul Loraine - Envy (Funk DVoid Remix) - Bigger Deer\r\n09. Magic Mountain High - Schnitzel Box 1 - Untitled 1 - Workshop\r\n10. Ian Pooley - Indigo - Pokerflat\r\n11. Charles Webster feat. Thandi Draai - Fight For Freedom (Atjazz Astro Remix) - Miso','2012-05-06 23:03:51','mix-images/Deepsouthsounds/lodemann.jpg','mixes/Deepsouthsounds/Andre Lodemann - Fragments Podcast.mp3','NOTHING','NOTHING',1,1),(11,'Brawther \"back to basics\"','taken from back to basics podcast1','2012-05-13 19:45:57','mix-images/Deepsouthsounds/brawther.jpg','mixes/Deepsouthsounds/Brawther - BackToBasics Podcast 01.mp3','/','/',1,1),(12,'Robert Bruen \"chilled\"','1.tom midleton - optimysic\r\n2.digby jones - pina colada\r\n3.crazy p - you\'ve lost that loving feeling\r\n4.jakatta - one fine day\r\n5.st.germain - sure thing\r\n6.moby - porcelain\r\n7.max melvin - whatever\r\n8.bliss - dontlook back (fug mix)\r\n9.ulrich schnauss - passing by\r\n10.groove armada - fireside favorite\r\n11.bullitnuts - heavy air\r\n12.aim - just passin thru\r\n13.crazy p - play it cool\r\n','2012-05-14 22:09:30','mix-images/Deepsouthsounds/chillout mix 1 Album Art.jpg','mixes/Deepsouthsounds/chillout mix - Bruen.mp3','/','/',1,1),(16,'tigerskin','mp3','2012-05-24 18:00:22','','mixes/Deepsouthsounds/deep love tigerskin.mp3','/','/',1,1),(17,'Test','teste','2012-05-27 10:02:31','','mixes/Deepsouthsounds/house_lo.mp3','','',1,1); -/*!40000 ALTER TABLE `spa_mix` ENABLE KEYS */; -UNLOCK TABLES; diff --git a/_working/recurrence.sql b/_working/recurrence.sql deleted file mode 100644 index 7801e8b..0000000 --- a/_working/recurrence.sql +++ /dev/null @@ -1,6 +0,0 @@ -LOCK TABLES `spa_recurrence` WRITE; -DELETE FROM `spa_recurrence`; -/*!40000 ALTER TABLE `spa_recurrence` DISABLE KEYS */; -INSERT INTO `spa_recurrence` VALUES (1),(2),(3); -/*!40000 ALTER TABLE `spa_recurrence` ENABLE KEYS */; -UNLOCK TABLES; \ No newline at end of file diff --git a/_working/release.sql b/_working/release.sql deleted file mode 100644 index 482d2bc..0000000 --- a/_working/release.sql +++ /dev/null @@ -1,6 +0,0 @@ -LOCK TABLES `spa_release` WRITE; -DELETE FROM `spa_release`; -/*!40000 ALTER TABLE `spa_release` DISABLE KEYS */; -INSERT INTO `spa_release` VALUES (1,'Nikola Gala','Got To Pray (Moodymanc\'s higher state mix)','Out next week on BEEF recordings... this is the first of 3 mixes I did for the mighty Nikola Gala, the other two for later release... The release pack includes a great mix by the BEEF head honchos Shades of Grey too... :) As ever, all support is very much appreciated!','release-images/4f8ea02e-e2dd-11e1-a30e-00163e1b2ddf/artworks-000028156348-q5glvm-t200x200.jpg',2,'2012-08-19','',1,1),(2,'Tagträumer²','Own Thing ','\"Rauschzeit\" flushes your ears with warm and deep sounds\r\n- dizziness caused by an oldschool bass and available to you only on an analog record - VINYL !\r\n\r\nThe first release features the Berlin Vinyl-Dj Tagträumer²\r\nand is supported by amazing remixes by Oscar and Philipp Ort.\r\nReleased by: Rauschzeit\r\nRelease/catalogue number: RZ001\r\nRelease date: Sep 1, 2012 ','release-images/9b028332-e2e1-11e1-a0bb-00163e1b2ddf/artworks-000028220406-hhpwae-t200x200.jpg',3,'2012-09-01','',1,1),(3,'Dale Howard ','Inner City EP ','Dale Howard makes his second appearance on Lost My Dog following the \'Merrt EPâ earlier in 2012. The \'Inner City EPâ offers 4 more shining examples of Dale\'s take on garage-influenced house music, with huge basslines and skipping beats paving the way for vintage synth stabs.\r\n\r\nIt\'s a sound which has seen him hit the top of the sales charts for labels including Neurotraxx Deluxe, Off Recordings and Fear Of Flying. Dale has future releases penned for Noir and Morris Audio, as well as his own Static Audio imprint.\r\n\r\nLinks:\r\nhttps://www.facebook.com/dalehowardmusic\r\nhttp://www.lostmydog.net\r\nhttp://www.facebook.com/lostmydog\r\nReleased by: Lost My Dog\r\nRelease/catalogue number: LMD063\r\nRelease date: Sep 3, 2012 ','release-images/e8b6e0c8-e2e1-11e1-a39a-00163e1b2ddf/artworks-000028156319-usvb8y-t200x200.jpg',4,'2012-09-03','',1,1); -/*!40000 ALTER TABLE `spa_release` ENABLE KEYS */; -UNLOCK TABLES; diff --git a/_working/release_audio.sql b/_working/release_audio.sql deleted file mode 100644 index bcbe76e..0000000 --- a/_working/release_audio.sql +++ /dev/null @@ -1,6 +0,0 @@ -LOCK TABLES `spa_releaseaudio` WRITE; -/*!40000 ALTER TABLE `spa_releaseaudio` DISABLE KEYS */; -DELETE FROM `spa_releaseaudio`; -INSERT INTO `spa_releaseaudio` VALUES (1,'release-audio/52d0c44f-db22-11e1-a030-0011b10a15ae/Late Nite Tuff Guy - One Night In the Disco.mp3',1,'Test release from someone or something..'); -/*!40000 ALTER TABLE `spa_releaseaudio` ENABLE KEYS */; -UNLOCK TABLES; diff --git a/_working/social.sql b/_working/social.sql deleted file mode 100644 index 2debdc8..0000000 --- a/_working/social.sql +++ /dev/null @@ -1,6 +0,0 @@ -LOCK TABLES `socialaccount_socialapp` WRITE; -DELETE FROM `socialaccount_socialapp`; -/*!40000 ALTER TABLE `socialaccount_socialapp` DISABLE KEYS */; -INSERT INTO `socialaccount_socialapp` VALUES (1,1,'facebook','Facebook','154504534677009','8eb42253ef42e3133ee76348255c2d78'),(2,1,'twitter','Twitter','qmvJ6tptgd8G9T9WYp6P3Q','ts6bYmZdnYxj7EscOvfz7YTwHu7r8OVGTkZWKhYqex8'); -/*!40000 ALTER TABLE `socialaccount_socialapp` ENABLE KEYS */; -UNLOCK TABLES; diff --git a/_working/venue.sql b/_working/venue.sql deleted file mode 100644 index ceea957..0000000 --- a/_working/venue.sql +++ /dev/null @@ -1,6 +0,0 @@ -LOCK TABLES `spa_venue` WRITE; -DELETE FROM `spa_venue`; -/*!40000 ALTER TABLE `spa_venue` DISABLE KEYS */; -INSERT INTO `spa_venue` VALUES (1,1,'The Pavillion','Carey\'s Lane','venue-images/5344256c-e2fc-11e1-a282-00163e1b2ddf/Pavilion_Upstairs_1-894x600.jpg'); -/*!40000 ALTER TABLE `spa_venue` ENABLE KEYS */; -UNLOCK TABLES; diff --git a/spa/api/v1/ReleaseResource.py b/spa/api/v1/ReleaseResource.py index ccaa7a6..b90920d 100644 --- a/spa/api/v1/ReleaseResource.py +++ b/spa/api/v1/ReleaseResource.py @@ -1,5 +1,4 @@ import datetime -import humanize from tastypie import fields from tastypie.authorization import Authorization from tastypie.constants import ALL_WITH_RELATIONS @@ -37,9 +36,6 @@ class ReleaseResource(BackboneCompatibleResource): bundle.data['mode'] = 'release' return bundle - def dehydrate_release_date(self, bundle): - return humanize.naturalday(bundle.obj.release_date) - def dehydrate_release_image(self, bundle): return bundle.obj.get_image_url() diff --git a/spa/views.py b/spa/views.py index 0edf38b..fbeae10 100644 --- a/spa/views.py +++ b/spa/views.py @@ -7,19 +7,21 @@ def _app(request): return social_redirect(request) def app(request): - if request.META['HTTP_USER_AGENT'].startswith('facebookexternalhit'): - return social_redirect(request) - else: - return render_to_response( - "inc/app.html", - context_instance=RequestContext(request)) + if 'HTTP_USER_AGENT' in request.META: + if request.META['HTTP_USER_AGENT'].startswith('facebookexternalhit'): + return social_redirect(request) + + return render_to_response( + "inc/app.html", + context_instance=RequestContext(request)) def default(request): - if request.META['HTTP_USER_AGENT'].startswith('facebookexternalhit'): - return social_redirect(request) - else: - backbone_url = "http://%s/#%s" % (request.get_host(), rreplace(lreplace(request.path, '/', ''), '/', '')) - return redirect(backbone_url) + if 'HTTP_USER_AGENT' in request.META: + if request.META['HTTP_USER_AGENT'].startswith('facebookexternalhit'): + return social_redirect(request) + + backbone_url = "http://%s/#%s" % (request.get_host(), rreplace(lreplace(request.path, '/', ''), '/', '')) + return redirect(backbone_url) def upload(request): return render_to_response("inc/upload.html", context_instance=RequestContext(request)) diff --git a/static/js/app/app.js b/static/js/app/app.js index 3778120..df6a8d2 100644 --- a/static/js/app/app.js +++ b/static/js/app/app.js @@ -6,194 +6,245 @@ Code provided under the BSD License: */ -var AppRouter = Backbone.Router.extend({ - routes:{ - "mixes":"mixList", - "mixes/:type":"mixList", - "mix/upload":"mixUpload", - "mix/:id":"mixDetails", - "mix/edit/:id":"mixEdit", - "releases":"releaseList", - "release/add":"releaseAdd", - "release/:id":"releaseDetails", - "events":"eventList", - "event/add":"eventAdd", - "event/:id":"eventDetails", - "accounts/social/connections/":"connectAccounts", - "accounts/facebook/login":"loginRedirect", - "accounts/login/":"login", - "accounts/logout/":"logout", - "upload/":"defaultRoute", - "me":"userDetails", - "*path":"defaultRoute" + var AppRouter = Backbone.Router.extend({ + routes: { + "mixes": "mixList", + "mixes/:type": "mixList", + "mix/upload": "mixUpload", + "mix/:id": "mixDetails", + "mix/edit/:id": "mixEdit", + "releases": "releaseList", + "release/:id": "releaseDetails", + "release/add": "releaseAdd", + "release/edit/:id": "releaseEdit", + "events": "eventList", + "event/add": "eventAdd", + "event/:id": "eventDetails", + "accounts/social/connections/": "connectAccounts", + "accounts/facebook/login": "loginRedirect", + "accounts/login/": "login", + "accounts/logout/": "logout", + "upload/": "defaultRoute", + "me": "userDetails", + "*path": "defaultRoute" }, - initialize:function () { + initialize: function() { this.headerView = new HeaderView(); $('#header').html(this.headerView.el); $('#site-content-fill').html(''); this.bind('all', this.trackPageView); }, - trackPageView:function () { + trackPageView: function() { var url; url = Backbone.history.getFragment(); return com.podnoms.utils.trackPageView(url); }, - defaultRoute:function (path) { - if (path == undefined || path == "" || path == "/") - this.mixList('latest'); + defaultRoute: function(path) { + if(path == undefined || path == "" || path == "/") this.mixList('latest'); }, - mixList:function (type) { + mixList: function(type) { var mixList = new MixCollection(); mixList.type = type || 'latest'; $('#site-content-fill').html(''); this.sidebarView = new SidebarView(); $('#sidebar').html(this.sidebarView.el); - startChat($('#chat-messages-body', this.sidebarView.el), $('#input', this.sidebarView.el), $('#status', this.sidebarView.el), $('#header-profile-edit').text()); + startChat( + $('#chat-messages-body', this.sidebarView.el), + $('#input', this.sidebarView.el), + $('#status', this.sidebarView.el), + $('#header-profile-edit').text()); - var data = type != undefined ? $.param({sort:type}) : null; + + var data = type != undefined ? $.param({ + sort: type + }) : null; mixList.fetch({ - data:data, - success:function () { - var mixes = new MixListView({collection:mixList}); + data: data, + success: function() { + var mixes = new MixListView({ + collection: mixList + }); var content = mixes.el; $('#content').html(content); - if (mixes.itemPlaying != null) { + if(mixes.itemPlaying != null) { com.podnoms.settings.setupPlayer(mixes.itemPlaying.toJSON(), mixes.itemPlaying.get('id')); } } }); }, - mixDetails:function (id) { - var mix = new Mix({id:id}); + mixDetails: function(id) { + var mix = new Mix({ + id: id + }); mix.fetch({ - success:function () { - var html = new MixView({model:mix}); + success: function() { + var html = new MixView({ + model: mix + }); $('#content').html(html.el); $('#site-content-fill').html(''); - if (com.podnoms.player.isPlayingId(mix.get('id'))) { + if(com.podnoms.player.isPlayingId(mix.get('id'))) { com.podnoms.settings.setupPlayer(mix.toJSON(), mix.get('id')); } - }}); + } + }); }, - mixUpload:function (id) { - var html = new MixCreateView({model:new Mix()}); + mixUpload: function(id) { + var html = new MixCreateView({ + model: new Mix() + }); $('#content').html(html.el); $('#site-content-fill').html(''); }, - mixEdit:function (id) { - var mix = new Mix({id:id}); + mixEdit: function(id) { + var mix = new Mix({ + id: id + }); mix.fetch({ - success:function () { - var html = new MixCreateView({model:mix}); + success: function() { + var html = new MixCreateView({ + model: mix + }); $('#content').html(html.el); $('#site-content-fill').html(''); } }); }, - releaseList:function (page) { + releaseList: function(page) { var releaseList = new ReleaseCollection(); releaseList.fetch({ - success:function () { - var content = new ReleaseListView({collection:releaseList}).el; + success: function() { + var content = new ReleaseListView({ + collection: releaseList + }).el; $('#content').html(content); } }); }, - releaseDetails:function (id) { - var release = new Release({id:id}); + releaseDetails: function(id) { + var release = new Release({ + id: id + }); $('#site-content-fill').html(''); - release.fetch({success:function () { - var content = new ReleaseView({model:release}).el; - $('#content').html(content); - /* - var audio = new ReleaseAudioCollection(); - audio.url = com.podnoms.settings.urlRoot + release.attributes.item_url + "/release_audio/"; - audio.audio_id = id; - audio.release = release.get("resource_uri"); - audio.fetch({success:function (data) { - var content = new ReleaseAudioListView({collection:audio}); - $('#release-description').html(content.el); - }}); - */ - }}); + release.fetch({ + success: function() { + var content = new ReleaseView({ + model: release + }).el; + $('#content').html(content); + } + }); }, - releaseAdd:function () { - var html = new ReleaseCreateView({model:new Release({ release_date:com.podnoms.utils.getDateAsToday() })}); + releaseAdd: function() { + var html = new ReleaseCreateView({ + model: new Release({ + release_date: com.podnoms.utils.getDateAsToday() + }) + }); $('#content').html(html.el); $('#site-content-fill').html(''); }, - eventList:function (page) { + releaseEdit: function(id) { + var release = new Release({ + id: id + }); + release.fetch({ + success: function() { + var html = new ReleaseCreateView({ + model: release + }); + $('#content').html(html.el); + $('#site-content-fill').html(''); + } + }); + }, + eventList: function(page) { var eventList = new EventCollection(); eventList.fetch({ - success:function () { - var content = new EventListView({collection:eventList}).el; + success: function() { + var content = new EventListView({ + collection: eventList + }).el; $('#content').html(content); } }); }, - eventDetails:function (id) { - var event = new Event({id:id}); + eventDetails: function(id) { + var event = new Event({ + id: id + }); $('#site-content-fill').html(''); - event.fetch({success:function () { - var content = new EventView({model:event}).el; - $('#content').html(content); - }}); + event.fetch({ + success: function() { + var content = new EventView({ + model: event + }).el; + $('#content').html(content); + } + }); }, - eventAdd:function () { - var html = new EventCreateView({model:new Event({ event_date:com.podnoms.utils.getDateAsToday() })}); + eventAdd: function() { + var html = new EventCreateView({ + model: new Event({ + event_date: com.podnoms.utils.getDateAsToday() + }) + }); $('#content').html(html.el); $('#site-content-fill').html(''); }, - loginRedirect:function(){ + loginRedirect: function() { com.podnoms.utils.showAlert("Success", "Thank you for logging in.", "alert-success", true); this.defaultRoute(); }, - login:function () { + login: function() { $.colorbox({ - href:"/tpl/LoginView/", - onClosed:function () { - Backbone.history.navigate('/', {trigger:true}); + href: "/tpl/LoginView/", + onClosed: function() { + Backbone.history.navigate('/', { + trigger: true + }); } }) }, - logout:function () { + logout: function() { com.podnoms.utils.showAlert("Success", "You are now logged out", "alert-success", true); }, - connectAccounts:function () { + connectAccounts: function() { alert("Connecting accounts"); }, - userDetails:function () { + userDetails: function() { var user = new User(); $('#site-content-fill').html(''); - user.fetch({success:function () { - var content = new UserView({model:user}).el; - $('#content').html(content); - }}); + user.fetch({ + success: function() { + var content = new UserView({ + model: user + }).el; + $('#content').html(content); + } + }); } }); -com.podnoms.utils.loadTemplate([ - 'HeaderView', 'SidebarView', 'UserView', - 'MixListView', 'MixListItemView', 'MixView', 'MixCreateView', - 'CommentListView', 'CommentListItemView', - 'ReleaseListView', 'ReleaseListItemView', 'ReleaseItemView', 'ReleaseView', 'ReleaseCreateView', 'ReleaseAudioListView', 'ReleaseAudioItemView', - 'EventCreateView', 'EventListView', 'EventListItemView', 'EventView', 'EventItemView' -], function () { - window.app = new AppRouter(); - $(document).on('click', 'a:internal:not(.no-click)', function (event) { - Backbone.history.navigate($(this).attr('href'), {trigger:true}); - return false; +com.podnoms.utils.loadTemplate(['HeaderView', 'SidebarView', 'UserView', 'MixListView', 'MixListItemView', 'MixView', 'MixCreateView', 'CommentListView', 'CommentListItemView', 'ReleaseListView', 'ReleaseListItemView', 'ReleaseItemView', 'ReleaseView', 'ReleaseCreateView', 'ReleaseAudioListView', 'ReleaseAudioItemView', 'EventCreateView', 'EventListView', 'EventListItemView', 'EventView', 'EventItemView'], function() { + window.app = new AppRouter(); + $(document).on('click', 'a:internal:not(.no-click)', function(event) { + Backbone.history.navigate($(this).attr('href'), { + trigger: true }); - /* + return false; + }); + /* $(document.body).find('a:internal:not(.no-click)').click(function(event){ Backbone.history.navigate($(this).attr('href'), {trigger: true}); return false; }); - */ - Backbone.history = Backbone.history || new Backbone.History({}); - Backbone.history.start({pushState:true}); - } -); +*/ +Backbone.history = Backbone.history || new Backbone.History({}); +Backbone.history.start({ + pushState: true +}); +}); var _eventAggregator = _.extend({}, Backbone.Events); \ No newline at end of file diff --git a/static/js/app/views/release.js b/static/js/app/views/release.js index 4133275..54edacb 100644 --- a/static/js/app/views/release.js +++ b/static/js/app/views/release.js @@ -7,8 +7,8 @@ */ var ReleaseListItemView = Backbone.View.extend({ - tagName:"tr", - initialize:function () { + tagName: "tr", + initialize: function () { $(this.el).addClass("rowlink"); $(this.el).data("id", this.model.get("id")); this.render(); @@ -22,10 +22,10 @@ var ReleaseListView = Backbone.View.extend({ events:{ "click tr":"showDetails" }, - initialize:function () { + initialize: function () { this.render(); }, - render:function () { + render: function () { $(this.el).html(this.template()); var el = this.el; this.collection.each(function (item) { @@ -61,6 +61,7 @@ var ReleaseItemView = Backbone.View.extend({ if (com.podnoms.utils.isEmpty(this.model.get('release_image'))){ $('#release-image-div', this.el).remove(); } + $('#release_date', this.el). return this; } }); diff --git a/static/js/libs/bootstrap/bootstrap-datepicker.js b/static/js/libs/bootstrap/bootstrap-datepicker.js index c3630ea..8875ec1 100644 --- a/static/js/libs/bootstrap/bootstrap-datepicker.js +++ b/static/js/libs/bootstrap/bootstrap-datepicker.js @@ -46,10 +46,37 @@ this.element.on('click', $.proxy(this.show, this)); } } - - this.viewMode = 0; + this.minViewMode = options.minViewMode||this.element.data('date-minviewmode')||0; + if (typeof this.minViewMode === 'string') { + switch (this.minViewMode) { + case 'months': + this.minViewMode = 1; + break; + case 'years': + this.minViewMode = 2; + break; + default: + this.minViewMode = 0; + break; + } + } + this.viewMode = options.viewMode||this.element.data('date-viewmode')||0; + if (typeof this.viewMode === 'string') { + switch (this.viewMode) { + case 'months': + this.viewMode = 1; + break; + case 'years': + this.viewMode = 2; + break; + default: + this.viewMode = 0; + break; + } + } + this.startViewMode = this.viewMode; this.weekStart = options.weekStart||this.element.data('date-weekstart')||0; - this.weekEnd = this.weekStart == 0 ? 6 : this.weekStart - 1; + this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1; this.fillDow(); this.fillMonths(); this.update(); @@ -80,19 +107,19 @@ hide: function(){ this.picker.hide(); $(window).off('resize', this.place); - this.viewMode = 0; + this.viewMode = this.startViewMode; this.showMode(); if (!this.isInput) { $(document).off('mousedown', this.hide); } - this.setValue(); + this.set(); this.element.trigger({ type: 'hide', date: this.date }); }, - setValue: function() { + set: function() { var formated = DPGlobal.formatDate(this.date, this.format); if (!this.isInput) { if (this.component){ @@ -104,6 +131,17 @@ } }, + setValue: function(newDate) { + if (typeof newDate === 'string') { + this.date = DPGlobal.parseDate(newDate, this.format); + } else { + this.date = new Date(newDate); + } + this.set(); + this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0); + this.fill(); + }, + place: function(){ var offset = this.component ? this.component.offset() : this.element.offset(); this.picker.css({ @@ -112,12 +150,12 @@ }); }, - update: function(){ + update: function(newDate){ this.date = DPGlobal.parseDate( - this.isInput ? this.element.prop('value') : this.element.data('date'), + typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')), this.format ); - this.viewDate = new Date(this.date); + this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0); this.fill(); }, @@ -157,7 +195,7 @@ html = []; var clsName; while(prevMonth.valueOf() < nextMonth) { - if (prevMonth.getDay() == this.weekStart) { + if (prevMonth.getDay() === this.weekStart) { html.push(''); } clsName = ''; @@ -166,11 +204,11 @@ } else if (prevMonth.getMonth() > month) { clsName += ' new'; } - if (prevMonth.valueOf() == currentDate) { + if (prevMonth.valueOf() === currentDate) { clsName += ' active'; } html.push(''+prevMonth.getDate() + ''); - if (prevMonth.getDay() == this.weekEnd) { + if (prevMonth.getDay() === this.weekEnd) { html.push(''); } prevMonth.setDate(prevMonth.getDate()+1); @@ -183,7 +221,7 @@ .text(year) .end() .find('span').removeClass('active'); - if (currentYear == year) { + if (currentYear === year) { months.eq(this.date.getMonth()).addClass('active'); } @@ -196,7 +234,7 @@ .find('td'); year -= 1; for (var i = -1; i < 11; i++) { - html += ''+year+''; + html += ''+year+''; year += 1; } yearCont.html(html); @@ -206,7 +244,7 @@ e.stopPropagation(); e.preventDefault(); var target = $(e.target).closest('span, td, th'); - if (target.length == 1) { + if (target.length === 1) { switch(target[0].nodeName.toLowerCase()) { case 'th': switch(target[0].className) { @@ -218,9 +256,10 @@ this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call( this.viewDate, this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) + - DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1) + DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1) ); this.fill(); + this.set(); break; } break; @@ -232,8 +271,17 @@ var year = parseInt(target.text(), 10)||0; this.viewDate.setFullYear(year); } + if (this.viewMode !== 0) { + this.date = new Date(this.viewDate); + this.element.trigger({ + type: 'changeDate', + date: this.date, + viewMode: DPGlobal.modes[this.viewMode].clsName + }); + } this.showMode(-1); this.fill(); + this.set(); break; case 'td': if (target.is('.day')){ @@ -246,12 +294,13 @@ } var year = this.viewDate.getFullYear(); this.date = new Date(year, month, day,0,0,0,0); - this.viewDate = new Date(year, month, day,0,0,0,0); + this.viewDate = new Date(year, month, Math.min(28, day),0,0,0,0); this.fill(); - this.setValue(); + this.set(); this.element.trigger({ type: 'changeDate', - date: this.date + date: this.date, + viewMode: DPGlobal.modes[this.viewMode].clsName }); } break; @@ -266,21 +315,21 @@ showMode: function(dir) { if (dir) { - this.viewMode = Math.max(0, Math.min(2, this.viewMode + dir)); + this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir)); } this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); } }; - $.fn.datepicker = function ( option ) { + $.fn.datepicker = function ( option, val ) { return this.each(function () { var $this = $(this), data = $this.data('datepicker'), - options = typeof option == 'object' && option; + options = typeof option === 'object' && option; if (!data) { $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options)))); } - if (typeof option == 'string') data[option](); + if (typeof option === 'string') data[option](val); }); }; @@ -319,18 +368,22 @@ return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] }, parseFormat: function(format){ - var separator = format.match(/[.\/-].*?/), + var separator = format.match(/[.\/\-\s].*?/), parts = format.split(/\W+/); - if (!separator || !parts || parts.length == 0){ + if (!separator || !parts || parts.length === 0){ throw new Error("Invalid date format."); } return {separator: separator, parts: parts}; }, parseDate: function(date, format) { var parts = date.split(format.separator), - date = new Date(1970, 1, 1, 0, 0, 0), + date = new Date(), val; - if (parts.length == format.parts.length) { + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + date.setMilliseconds(0); + if (parts.length === format.parts.length) { for (var i=0, cnt = format.parts.length; i < cnt; i++) { val = parseInt(parts[i], 10)||1; switch(format.parts[i]) { @@ -370,9 +423,9 @@ }, headTemplate: ''+ ''+ - ''+ + '‹'+ ''+ - ''+ + '›'+ ''+ '', contTemplate: '' diff --git a/templates/base.html b/templates/base.html index 187c64f..3e77c90 100644 --- a/templates/base.html +++ b/templates/base.html @@ -4,10 +4,8 @@ Deep South Sounds {% include 'inc/meta.html' %} - {% load compress %} - {% compress css %} @@ -21,9 +19,6 @@ {% endcompress %} - - - {% block headerscripts %} - {% endblock %} @@ -41,12 +35,10 @@ {% include 'inc/facebook_init.html' %} {% include 'inc/ancient_browser.html' %} -