Changeset 256edce in osmose-frontend


Ignore:
Timestamp:
Mar 8, 2014 10:32:31 PM (6 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Children:
f683942
Parents:
2bc0468
git-author:
Frédéric Rodrigo <fred.rodrigo@…> (05/03/2014 17:51:28)
git-committer:
Frédéric Rodrigo <fred.rodrigo@…> (08/03/2014 22:32:31)
Message:

Osmose Editor

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • static/map/Osmose.Editor.css

    r2bc0468 r256edce  
    2929#editor .tags { 
    3030  border: solid 1px gray; 
    31   background: #EEE; 
     31  background: #E7E7E7; 
    3232} 
    3333 
     
    4242#editor input[type="text"] { 
    4343  font-family: monospace; 
    44   background: #EEE; 
     44  background: #E7E7E7; 
    4545  border: none; 
    46   width: 95%; 
     46  width: 90%; 
    4747  padding-left: 5px; 
    4848} 
    4949 
    50 #editor .old { 
    51   position: absolute; 
    52   right: 0; 
    53   font-style: italic; 
    54   font-family: monospace; 
    55   text-decoration: line-through; 
     50#editor input[type="text"]:focus { 
     51  background: #F7F7F7; 
     52} 
     53 
     54#editor .line a { 
     55  display: inline-block; 
     56  width: 5%; 
     57  text-decoration: none; 
     58  text-align: center; 
     59  border-radius: 50%; 
     60  background: #fbb; 
    5661} 
    5762 
  • static/map/Osmose.Editor.js

    r2bc0468 r256edce  
    2525  edit: function (error, type, id) { 
    2626    var self = this; 
     27    self._$container.html("<center><img src='../images/throbbler.gif' alt='downloading'></center>"); 
     28    self.show(); 
    2729    $.ajax({ 
    2830      url: '../api/0.2/error/' + error + '/fresh_elems', 
     
    4850      }); 
    4951      $('form .tags[data-type="' + type + '"][data-id="' + id + '"] input[type="text"]:last', self._$container).focus(); 
    50       self.show(); 
    5152    }); 
    5253  }, 
     
    135136        type: eee.dataset.type, 
    136137        id: eee.dataset.id, 
     138        version: eee.dataset.version, 
    137139        touched: eee.dataset.touched == "true", 
    138140        tags: elem 
     
    171173        var value = $('<div/>').text(e + '=' + reftags[e]).html(), 
    172174          key = $('<div/>').text(e).html(); 
    173         del.append($('<span class="line"><span>-</span><input type="text" name="tags_del[]" value="' + value + '" data-key="' + key + '"/></span>')); 
     175        del.append($('<span class="line"><span>-</span><input type="text" name="tags_del[]" value="' + value + '" data-key="' + key + '"/><a href="#">×</a></span>')); 
    174176        touched = true; 
    175177      } 
     
    182184        var value = $('<div/>').text(e + '=' + reftags[e]).html(), 
    183185          key = $('<div/>').text(e).html(); 
    184         same.append($('<span class="line"><span>=</span><input type="text" name="tags_del[]" value="' + value + '" data-key="' + key + '"/></span>')); 
     186        same.append($('<span class="line"><span>=</span><input type="text" name="tags_del[]" value="' + value + '" data-key="' + key + '"/><a href="#">×</a></span>')); 
    185187      } 
    186188    }); 
     
    193195          key = $('<div/>').text(e).html(), 
    194196          old = $('<div/>').text(reftags[e]).html(); 
    195         mod.append($('<span class="line"><span>~</span><input type="text" name="tags_mod[]" value="' + value + '" data-key="' + key + '"/><span class="old">(' + old + ')</span></span>')); 
     197        mod.append($('<span class="line"><span>~</span><input type="text" name="tags_mod[]" value="' + value + '" data-key="' + key + '" title="' + old + '"/><a href="#">×</a></span>')); 
    196198        touched = true; 
    197199      } 
     
    204206        var value = $('<div/>').text(e + '=' + data[e]).html(), 
    205207          key = $('<div/>').text(e).html(); 
    206         add.append($('<span class="line"><span>+</span><input type="text" name="tags_add[]" value="' + value + '" data-key="' + key + '"/></span>')); 
     208        add.append($('<span class="line"><span>+</span><input type="text" name="tags_add[]" value="' + value + '" data-key="' + key + '"/><a href="#">×</a></span>')); 
    207209        touched = true; 
    208210      } 
     
    219221      self._keypress(e); 
    220222    }); 
     223    $("a", tags).click(function (e) { 
     224      self._delete_tag(e); 
     225      return false; 
     226    }); 
     227  }, 
     228 
     229  _delete_tag: function(e) { 
     230    var action = $(e.target).closest('div'), 
     231      span = $(e.target).closest('span'), 
     232      input = span.find('input').get()[0], 
     233      tags = $(e.target).closest(".tags"), 
     234      reftags = tags.data('reftags'); 
     235    if (action.hasClass('del')) { 
     236      span.appendTo(tags.find('.add')); 
     237    } else if (action.hasClass('mod')) { 
     238      input.value = input.dataset.key + '=' + reftags[input.dataset.key]; 
     239    } else if(action.hasClass('same') || action.hasClass('add')) { 
     240      input.value = ''; 
     241    } 
     242    this._change({target: input}); 
    221243  }, 
    222244 
     
    229251      inputs.eq(inputs.index(e.target) + 1).focus(); 
    230252    } else if (e.key == "Backspace" && e.ctrlKey) { // Ctrl + Backspace 
    231       e.target.value = ''; 
    232       this._change(e); 
     253      this._delete_tag(e); 
    233254    } 
    234255  }, 
  • views/map/editor.tpl

    r9569ea1 r256edce  
    44  <%#elems%> 
    55  <a target="_blank" href="http://www.openstreetmap.org/browse/<%type%>/<%id%>"><%type%> <%id%></a> 
    6   <div class="tags" data-type="<%type%>" data-id="<%id%>"> 
     6  <div class="tags" data-type="<%type%>" data-id="<%id%>" data-version="<%version%>"> 
    77    <div class="del"> 
    88    </div> 
  • views/map/index.tpl

    r2bc0468 r256edce  
    183183<div id="editor"></div> 
    184184 
    185 <div id="dialog_editor_save_popup" title="{{_("Save changeset")}}" data-button_cancel="{{_("Cancel")}}" data-button_save="{{_("Save")}}"> 
     185<div id="dialog_editor_save_popup" title="{{_("Save changeset")}}" data-button_cancel="{{_("Cancel")}}" data-button_save="{{_("Save")}}" style="display:none"> 
    186186  <p>{{_("Objects edited:")}}&nbsp;<span id="editor-edited-count"></span></p> 
    187187  <p>{{_("Objects deleted:")}}&nbsp;<span id="editor-deleted-count"></span></p> 
Note: See TracChangeset for help on using the changeset viewer.