Skip to content

Commit

Permalink
Put directives into thir own folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen1 committed May 7, 2014
1 parent f713c1d commit a9171b9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 29 deletions.
1 change: 1 addition & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
<script src="scripts/directives/splitter-bar.js"></script>
<!-- endbuild -->
</body>
</html>
28 changes: 1 addition & 27 deletions app/scripts/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,32 +119,6 @@ PhonicsApp.controller('MainCtrl', ['$scope', function ($scope) {
$scope.editor.getSession().setValue(newValue);
};

}]).directive('splitterBar', function(){
return {
template: '',
replace: false,
restrict: 'E',
link: function($scope, $element, $attributes){
var $document = $(document);
function resize(mouseMoveEvent){
var x = mouseMoveEvent.pageX;
var MIN_WIDTH = 100;
if( x < MIN_WIDTH || x > window.innerWidth - MIN_WIDTH) {
return;
}
$element.css('left', x);
$('#' + $attributes.leftPane).css('width', x);
$('#' + $attributes.rightPane).css('width',
window.innerWidth - x - $element.width());
}
$element.on('mousedown', function(){
$document.on('mousemove', resize);
$document.on('mouseup', function(){
$document.off('mousemove', resize);
});
});
}
};
});
}]);


29 changes: 29 additions & 0 deletions app/scripts/directives/splitter-bar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

PhonicsApp.directive('splitterBar', function(){
return {
template: '',
replace: false,
restrict: 'E',
link: function($scope, $element, $attributes){
var $document = $(document);
function resize(mouseMoveEvent){
var x = mouseMoveEvent.pageX;
var MIN_WIDTH = 100;
if( x < MIN_WIDTH || x > window.innerWidth - MIN_WIDTH) {
return;
}
$element.css('left', x);
$('#' + $attributes.leftPane).css('width', x);
$('#' + $attributes.rightPane).css('width',
window.innerWidth - x - $element.width());
}
$element.on('mousedown', function(){
$document.on('mousemove', resize);
$document.on('mouseup', function(){
$document.off('mousemove', resize);
});
});
}
};
});
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-X');
ga('send', 'pageview');</script><script src="scripts/22ed9f80.scripts.js"></script>
ga('send', 'pageview');</script><script src="scripts/9280e644.scripts.js"></script>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9171b9

Please sign in to comment.