Skip to content

Commit

Permalink
fixes #10 and resolves #7
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoliv committed Feb 16, 2014
1 parent c4eadf4 commit d5586a4
Show file tree
Hide file tree
Showing 20 changed files with 1,054 additions and 71,282 deletions.
10 changes: 5 additions & 5 deletions css/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}

@mixin opacity ($op){
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=${op})";
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$op})";
filter: alpha(opacity=$op);
opacity: $op/100;
}
Expand All @@ -39,15 +39,15 @@
@mixin font-size ($sizeValue) {
$remValue: $sizeValue;
$pxValue: $sizeValue * 10;
font-size: ($pxValue)px;
font-size: ($remValue)rem;
font-size: #{$pxValue}px;
font-size: #($remValue}rem;
}

@mixin line-height ($sizeValue) {
$remValue: $sizeValue;
$pxValue: $sizeValue * 10;
line-height: ($pxValue)px;
line-height: ($remValue)rem;
line-height: #{$pxValue}px;
line-height: #{$remValue}rem;
}

// The micro clearfix http://nicolasgallagher.com/micro-clearfix-hack/
Expand Down
42 changes: 41 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var gulp = require( 'gulp' ),
rename = require( 'gulp-rename' ),
clean = require( 'gulp-clean' ),
concat = require( 'gulp-concat' );
header = require( 'gulp-header' ),
footer = require( 'gulp-footer' );

// styles task
gulp.task( 'styles', function() {
Expand All @@ -20,8 +22,46 @@ gulp.task( 'styles', function() {

// scripts task
gulp.task( 'scripts', function() {
return gulp.src( 'js/**/*.js' )

var customHeader = [
'(function ( $ ) {',
'"use strict";',
'',
' $(function () {',

This comment has been minimized.

Copy link
@kadamwhite

kadamwhite Feb 17, 2014

This has the result of running the entire JS file on the document ready event—is this the desired behavior? If this script was loaded in the footer this behavior would be effectively redundant, and if there's any code other than event binding and plugin instantiation that runs in these files we are losing efficiency by deferring that code's execution into this block.

'',
''].join('\n');

var customFooter = [
'',
'',
' });',
'',
'}(jQuery));'].join('\n');

// passa an array of files instead of a blob to make sure that the files will be concatenated in the correct order
var filesOrder = [
'js/src/post.main.js',
'js/src/post.Uploader.js',
'js/src/post.addBlockMenu.js',
'js/src/post.ParentView.js',
'js/src/post.textView.js',
'js/src/post.quoteView.js',
'js/src/post.codeView.js',
'js/src/post.audioView.js',
'js/src/post.videoView.js',
'js/src/post.embedView.js',
'js/src/post.tweetView.js',
'js/src/post.imgView.js',
'js/src/post.galleryView.js',
'js/src/post.View.js',
'js/src/misc.js',
];

return gulp.src( filesOrder )
.pipe( concat( 'main.js' ) )
.pipe( header( customHeader ) )
.pipe( footer( customFooter ) )
.pipe( gulp.dest( 'js' ) )
.pipe( rename({ suffix: '.min' }) )
.pipe( uglify() )
.pipe( gulp.dest( 'js' ) )
Expand Down
30 changes: 18 additions & 12 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
(function ( $ ) {
"use strict";
"use strict";

$(function () {

$(function () {

// the post namespace
var post = post || {};

// the post model - contains all the data of the post
post.Data = Backbone.Model.extend({
defaults: {
title: 'Your title here',
permalink: '',
content: {},
meta: {},
}
});
post.Data = Backbone.Model.extend();

// get button template via ajax
$.get( ajaxurl, { action: 'get_cb_button_tpl' } ).done( function( tpl ){
Expand All @@ -25,6 +18,7 @@

});


// a custom object for Plupload plugin
post.Uploader = Backbone.Model.extend({
initialize: function(){
Expand Down Expand Up @@ -81,6 +75,7 @@
},
})


// CONTENT BLOCKS CONTAINER ====================================================================================//

// The Block selector default model
Expand Down Expand Up @@ -226,6 +221,7 @@
});



// CONTENT BLOCKS ==============================================================================================//
// Block default model
post.Block = Backbone.Model.extend({
Expand Down Expand Up @@ -331,11 +327,13 @@
isEditable: true
});


// QUOTE CONTENT BLOCK
post.quoteView = post.BlockView.extend({
tpl: '#wp-quote',
});


// CODE CONTENT BLOCK
post.codeView = post.BlockView.extend({
tpl: '#wp-code',
Expand All @@ -345,6 +343,7 @@
}
});


// AUDIO CONTENT BLOCK
post.audioView = post.BlockView.extend({
tpl: '#wp-audio',
Expand All @@ -361,16 +360,19 @@
}
});


// EMBED CONTENT BLOCK
post.embedView = post.BlockView.extend({
tpl: '#wp-embed',
});


// TWEET CONTENT BLOCK
post.tweetView = post.BlockView.extend({
tpl: '#wp-tweet',
});


// IMAGE CONTENT BLOCK
post.imgView = post.BlockView.extend({
tpl: '#wp-image',
Expand Down Expand Up @@ -578,6 +580,7 @@
}
});


// GALLERY CONTENT BLOCK ===========================================================================//

// a model for each image in a gallery
Expand Down Expand Up @@ -823,6 +826,7 @@
this.$el.find('.drag-drop-area').removeClass('drag-over');
}
});


// the post view =======================================================================//

Expand Down Expand Up @@ -890,6 +894,7 @@
this.$postPlaceholder.remove();
} else {
this.$el.append( this.$postPlaceholderCopy );
this.$postPlaceholder = $( '#post-placeholder' );
}
},
blockMenu: function(e){
Expand Down Expand Up @@ -943,6 +948,7 @@
// initiate the content blocks view
post.view = new post.View({ collection: post.blocks });


// CONFIG ================================================================================================//

// TinyMCE config
Expand Down Expand Up @@ -996,6 +1002,6 @@
return true;
}

});
});

}(jQuery));
Loading

0 comments on commit d5586a4

Please sign in to comment.