Commit 325f34f6 authored by George Popoff's avatar George Popoff

add context field to message panel

parent 75d330c7
......@@ -82,7 +82,7 @@ class Typo extends CI_Model {
if ( $table == "messages" ) {
$this->db->select("m.id as message_id, m.link as link, m.text as text, "
. "m.comment as comment, m.date as message_date, m.status as message_status, u.*");
. "m.comment as comment, m.context as context, m.date as message_date, m.status as message_status, u.*");
$this->db->from("messages as m, users as u");
$this->db->join("responsible as r", "r.id_user = u.id AND"
. " r.id_site = m.site_id AND r.id_user = u.id");
......@@ -141,9 +141,14 @@ class Typo extends CI_Model {
$data['rows'][$id]['id'] = $row->message_id;
$data['rows'][$id]['cell'][] = $row->message_id;
$data['rows'][$id]['cell'][] = $row->message_status;
$data['rows'][$id]['cell'][] = anchor($row->link, 'ссылка', array('class' => 'typos_link', 'target' => '_blank'));;
$data['rows'][$id]['cell'][] = anchor($row->link, 'ссылка', array('class' => 'typos_link', 'target' => '_blank'));
$data['rows'][$id]['cell'][] = $row->text;
$data['rows'][$id]['cell'][] = $row->comment;
$data['rows'][$id]['cell'][] = anchor("#", 'показать',
array('class' => 'typos_context',
'onclick'=> 'return Typos.handleLink(this);',
'typo' => $row->text, 'context' => $row->context,
'correct' => $row->comment));
$data['rows'][$id]['cell'][] = $row->message_date;
}
}
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
document.addEventListener("DOMContentLoaded", function() {
Typos._init();
});
var Typos = {
_init: function() {
this.contextBlock = $("#context-block");
this.contextBlockText = this.contextBlock.children().first();
},
/**
* Показывает окно, содержащее информацию о контексте.
* @param {type} link Элемент a.typos_context
* @returns {Boolean}
*/
handleLink: function(link) {
var text = link.getAttribute("context");
var typo = link.getAttribute("typo");
var correct = link.getAttribute("correct");
var self = this;
text = text.replace(typo, "<span class='typo'>" + typo + " -> " + correct + "</span>");
self.contextBlockText.html(text);
self.contextBlock.dialog();
return false;
}
};
......@@ -30,4 +30,8 @@
padding-top: 50px;
clear: both;
text-align: center;
}
.typo {
background-color: rgba(200, 200, 10, 0.2);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment