ADDED update client (js)
This commit is contained in:
parent
1463253b86
commit
5a8cc4ddb7
|
@ -68,7 +68,8 @@
|
|||
font-size: .8em;
|
||||
}
|
||||
|
||||
#CONTAINER.message div span.del{ /* Del btn */
|
||||
#CONTAINER.message div span.del, /* Del btn */
|
||||
#CONTAINER.message div span.upd{ /* Update btn */
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: calc( 100% + .2em );
|
||||
|
@ -82,10 +83,19 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
#CONTAINER.message div span.upd{
|
||||
left: calc( 100% - 3em );
|
||||
background-image: url('/image/container/edit-msg.svg@777777');
|
||||
}
|
||||
|
||||
#CONTAINER.message div span.del:hover{
|
||||
background-image: url('/image/container/del-msg.svg@e33222')
|
||||
}
|
||||
|
||||
#CONTAINER.message div span.upd:hover{
|
||||
background-image: url('/image/container/edit-msg.svg@2ab1dd')
|
||||
}
|
||||
|
||||
#CONTAINER.message div span span.code{ /* Code block */
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="35.994999"
|
||||
viewBox="0 0 35.994999 35.994999"
|
||||
width="35.994999"
|
||||
id="svg4173"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="edit-msg.svg">
|
||||
<metadata
|
||||
id="metadata4183">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs4181" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1056"
|
||||
id="namedview4179"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:zoom="19.833333"
|
||||
inkscape:cx="18"
|
||||
inkscape:cy="18"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4173" />
|
||||
<path
|
||||
d="m 29.324219,0 c -0.5125,0 -1.024063,0.1959375 -1.414063,0.5859375 L 24.25,4.2441406 l 7.5,7.5000004 3.660156,-3.6582035 c 0.78,-0.78 0.78,-2.0500781 0,-2.8300781 L 30.740234,0.5859375 C 30.350234,0.1959375 29.836719,0 29.324219,0 Z M 22.130859,6.3652344 0,28.494141 l 0,7.5 7.5,0 22.130859,-22.128907 -7.5,-7.4999996 z"
|
||||
id="fill-edit"
|
||||
inkscape:connector-curvature="0" />
|
||||
</svg>
|
After Width: | Height: | Size: 1.9 KiB |
|
@ -129,6 +129,12 @@ gstore.add('new_msg', {
|
|||
emergency: '',
|
||||
event: ''
|
||||
});
|
||||
// edit-message container
|
||||
gstore.add('upd_msg', {
|
||||
inbox: null,
|
||||
emergency: null,
|
||||
event: null
|
||||
});
|
||||
// if message loader
|
||||
gstore.add('msg_pending', {
|
||||
inbox: true,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<span class='content' v-html='bbcode(msg.message)'></span>
|
||||
<span class='date' v-text='local_date(id)'></span>
|
||||
<span @click='del_message(msg.id)' class='del' v-if='msg.user == gstore.server.session.name'></span>
|
||||
<span @click='upd_message(msg.id, msg.message)' class='upd' v-if='msg.user == gstore.server.session.name'></span>
|
||||
</div>
|
||||
|
||||
<div class='end-pad'></div> <!-- End Spacing -->
|
||||
|
@ -53,31 +54,86 @@ export default {
|
|||
if( msg.trim().length == 0 )
|
||||
return;
|
||||
|
||||
/* (2) Prepare request */
|
||||
var rq = {
|
||||
message: this.gstore.new_msg.emergency,
|
||||
location: this.gstore.loc,
|
||||
username: this.gstore.server.session.name
|
||||
};
|
||||
|
||||
/* (3) Add loader */
|
||||
gstore.data.msg_pending.emergency = true;
|
||||
|
||||
/* (4) Send request */
|
||||
api.call("POST message/emergency/"+this.dep, rq, function(rs){
|
||||
/* (1) If in EDIT_MODE
|
||||
---------------------------------------------------------*/
|
||||
if( gstore.data.upd_msg.emergency != null ){
|
||||
|
||||
// {1} If error -> exit //
|
||||
if( rs.error != 0 )
|
||||
return;
|
||||
/* (2) Prepare request */
|
||||
var rq = {
|
||||
id: this.gstore.upd_msg.emergency,
|
||||
message: msg
|
||||
};
|
||||
|
||||
// {2} Empty input //
|
||||
gstore.data.new_msg.emergency = '';
|
||||
/* (3) Add loader */
|
||||
gstore.data.msg_pending.emergency = true;
|
||||
|
||||
/* (4) Send request */
|
||||
api.call("PUT message/emergency/"+this.dep, rq, function(rs){
|
||||
|
||||
// {1} If error -> exit //
|
||||
if( rs.error != 0 )
|
||||
return;
|
||||
|
||||
// {2} Update message content //
|
||||
for( var id in gstore.data.notif.emergency.data )
|
||||
if( gstore.data.notif.emergency.data[id].id == gstore.data.upd_msg.emergency )
|
||||
gstore.data.notif.emergency.data[id].message = msg;
|
||||
|
||||
|
||||
// {3} exit EDIT_MODE //
|
||||
gstore.data.upd_msg.emergency = null;
|
||||
|
||||
// {4} Empty input //
|
||||
gstore.data.new_msg.emergency = '';
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* (2) If IN NEW_MSG_MODE
|
||||
---------------------------------------------------------*/
|
||||
}else{
|
||||
|
||||
/* (2) Prepare request */
|
||||
var rq = {
|
||||
message: this.gstore.new_msg.emergency,
|
||||
location: this.gstore.loc,
|
||||
username: this.gstore.server.session.name
|
||||
};
|
||||
|
||||
/* (3) Add loader */
|
||||
gstore.data.msg_pending.emergency = true;
|
||||
|
||||
/* (4) Send request */
|
||||
api.call("POST message/emergency/"+this.dep, rq, function(rs){
|
||||
|
||||
// {1} If error -> exit //
|
||||
if( rs.error != 0 )
|
||||
return;
|
||||
|
||||
// {2} Empty input //
|
||||
gstore.data.new_msg.emergency = '';
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
del_message(id_msg){
|
||||
api.call("DELETE message/emergency/"+this.dep, { id: id_msg }, function(rs){});
|
||||
},
|
||||
upd_message(id_msg, msg_content){
|
||||
|
||||
/* (1) Move to 'edit_mode' */
|
||||
this.gstore.upd_msg.emergency = id_msg;
|
||||
|
||||
/* (2) Copy message content to INPUT */
|
||||
this.gstore.new_msg.emergency = msg_content;
|
||||
|
||||
|
||||
},
|
||||
bbcode: function(msg){
|
||||
return this.gstore.func.bbcode(msg);
|
||||
|
|
Loading…
Reference in New Issue