Skip to content

Commit

Permalink
Merge branch 'master' of git+ssh://208.43.61.234/var/scm/jotky-beta-2
Browse files Browse the repository at this point in the history
  • Loading branch information
BimoZX committed Apr 10, 2012
2 parents 94d132b + fe388e5 commit f384a06
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 31 deletions.
67 changes: 49 additions & 18 deletions web-client_v2/app/assets/javascripts/view/magicbox/magicbox_jot.js
Expand Up @@ -7,6 +7,12 @@ window.MagicboxJotView = Backbone.View.extend({

jot_title_maxlength: 140,

jot_more_maxlength: 512,

current_length_holder: $('#jot-input-text-length'),

current_more_length_holder: $('#jot-input-more-text-length'),

initialize: function(options){
this.options = $.extend({}, this.default_options, options);

Expand All @@ -26,6 +32,13 @@ window.MagicboxJotView = Backbone.View.extend({
this.setButtonAnimation();
this.setClipField();
this.setJotTagField();

this.needResetAfterSubmit();
},

needResetAfterSubmit: function(){
$(this.current_length_holder).text(this.jot_title_maxlength);
$(this.current_more_length_holder).text(this.jot_more_maxlength);
},

validates: function(){
Expand Down Expand Up @@ -53,18 +66,30 @@ window.MagicboxJotView = Backbone.View.extend({
else{
_this.jots.add(data.content);
}

$(form).find('input').removeAttr('disabled');
$(form).resetForm();

_this.jotBarWriteMore({}, 'hide');
//_this.jotBarClip({}, 'hide');
//_this.jotBarLocation({}, 'hide');
_this.jotBarTag({}, 'hide');
_this.setButtonAnimation({}, 'hide');
_this.needResetAfterSubmit();
},
beforeSend: function(jqXHR, settings){
$(form).find('input').attr({
disabled: 'disabled'
});
}
});

return false;
}
});

var current_length_holder = $('#jot-input-text-length');
current_length_holder.text(_this.jot_title_maxlength);

$('#jot-form-title-field').bind('keyup', function(){
current_length_holder.text(_this.jot_title_maxlength - this.value.length);
$(this.current_length_holder).text(_this.jot_title_maxlength - this.value.length);
});
},

Expand Down Expand Up @@ -154,8 +179,6 @@ window.MagicboxJotView = Backbone.View.extend({
'click #link-to-open-all-more-input': 'jotAllTag'
},

jot_more_maxlength: 512,

jotBarWriteMore: function(e, force){
var _this = this;

Expand All @@ -165,12 +188,9 @@ window.MagicboxJotView = Backbone.View.extend({
required: true,
maxlength: _this.jot_more_maxlength
});

var current_length_holder = $('#jot-input-more-text-length');
current_length_holder.text(this.jot_more_maxlength);

$('#jot-write-more-field').bind('keyup', function(){
current_length_holder.text(_this.jot_more_maxlength - this.value.length);
$(_this.current_more_length_holder).text(_this.jot_more_maxlength - this.value.length);
});
}
else if(force == 'hide'){
Expand Down Expand Up @@ -222,15 +242,24 @@ window.MagicboxJotView = Backbone.View.extend({
},

jotBarTag: function(e, force){

var _this = this;
if(force == 'show'){
_this.resetListJotTag([]);
$('#jot-tag-more').removeClass('hidden');
}
else if(force == 'hide'){
$('#jot-tag-more').addClass('hidden');
}
else{
$('#jot-tag-more').toggleClass('hidden');

$('#jot-tag-more').toggleClass(function(index, current_class_name){

if(/hidden/.test(current_class_name)){
_this.resetListJotTag([]);
}

return 'hidden';
})
}
},

Expand Down Expand Up @@ -311,8 +340,8 @@ window.MagicboxJotView = Backbone.View.extend({

if(this.jot_all_tag_is_open){
this.jotBarWriteMore(e, 'hide');
this.jotBarClip(e, 'hide');
this.jotBarLocation(e, 'hide');
//this.jotBarClip(e, 'hide');
//this.jotBarLocation(e, 'hide');
this.jotBarTag(e, 'hide');
this.setButtonAnimation(e, 'hide');

Expand All @@ -322,8 +351,8 @@ window.MagicboxJotView = Backbone.View.extend({
}
else{
this.jotBarWriteMore(e, 'show');
this.jotBarClip(e, 'show');
this.jotBarLocation(e, 'show');
//this.jotBarClip(e, 'show');
//this.jotBarLocation(e, 'show');
this.jotBarTag(e, 'show');
this.setButtonAnimation(e, 'show');

Expand All @@ -335,7 +364,7 @@ window.MagicboxJotView = Backbone.View.extend({
setJotTagField: function(e){
var _this = this;

$('#jot-form-title-field').on('propertychange input paste', function(event){
$('#jot-form-title-field').on('propertychange input paste reset', function(event){

if (($(this)).val().match(/#\w+/)){

Expand Down Expand Up @@ -364,7 +393,9 @@ window.MagicboxJotView = Backbone.View.extend({

$('#list-jot-tag-holder').html('');
_.each(data, function(jot_tag) {
_this.listJotTag({ name: jot_tag }, false);
_this.listJotTag({
name: jot_tag
}, false);
});
},

Expand Down
11 changes: 0 additions & 11 deletions web-client_v2/app/views/layouts/application.html.erb
Expand Up @@ -89,16 +89,5 @@
<% if flash[:error].present? %>
<script type="text/javascript">alert("<%= flash[:error] %>");</script>
<% end %>
<div id="map_canvas" style="width:100%; height:100%"></div>
<script>
var myOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);

</script>
</body>
</html>
4 changes: 2 additions & 2 deletions web-client_v2/app/views/templates/_magicbox.html.erb
Expand Up @@ -58,7 +58,7 @@
<span class="jot_button_text">Write more</span>
</a>
</li>
<li>
<!-- li>
<a href="javascript:void(0)" class="clip_but jot_but jot_buttons_color jot-bar-button" id="jot-bar-clip">
<span class="jot_clip_icon">&nbsp;</span>
<span class="jot_button_text">Clip</span>
Expand All @@ -69,7 +69,7 @@
<span class="jot_location_icon">&nbsp;</span>
<span class="jot_button_text">Location</span>
</a>
</li>
</li -->
<li>
<a href="javascript:void(0)" class="jot_but tags_but jot_buttons_color jot-bar-button" id="jot-bar-tag">
<span class="jot_tags_icon">&nbsp;</span>
Expand Down

0 comments on commit f384a06

Please sign in to comment.