Final Update From Caleb
Incorporated all Caleb's changes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template name="AppreciationEditor">
|
||||
<div id="appreciationEditor">
|
||||
<h1>Appreciation Editor</h1>
|
||||
<div id="editor"></div>
|
||||
<div class="editor"></div>
|
||||
<button id="save">Save</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -12,22 +12,32 @@ Template.AppreciationEditor.onRendered(function() {
|
||||
let _this = this;
|
||||
|
||||
//#appreciationEditor'
|
||||
CKEditor.create(document.querySelector('#editor'), {}).then(editor => {
|
||||
_this.ckEditor = editor;
|
||||
// CKEditor.create(document.querySelector('#editor'), {}).then(editor => {
|
||||
// _this.ckEditor = editor;
|
||||
//
|
||||
// Tracker.autorun(function() {
|
||||
// let doc = Meteor.collections.Pages.findOne({name: 'Appreciation'});
|
||||
//
|
||||
// originalData = (doc === undefined ? "" : doc.html);
|
||||
// editor.setData(originalData);
|
||||
// });
|
||||
// }).catch(err => {
|
||||
// console.error(err);
|
||||
// });
|
||||
$('.editor').tinymce({
|
||||
inline: true
|
||||
});
|
||||
Tracker.autorun(function() {
|
||||
let doc = Meteor.collections.Pages.findOne({name: 'Appreciation'});
|
||||
|
||||
Tracker.autorun(function() {
|
||||
let doc = Meteor.collections.Pages.findOne({name: 'Appreciation'});
|
||||
|
||||
originalData = (doc === undefined ? "" : doc.html);
|
||||
editor.setData(originalData);
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
originalData = (doc === undefined ? "" : doc.html);
|
||||
$('.editor').html(originalData);
|
||||
});
|
||||
});
|
||||
|
||||
Template.AppreciationEditor.onDestroyed(function() {
|
||||
let data = this.ckEditor.getData();
|
||||
// let data = this.ckEditor.getData();
|
||||
let data = $('.editor').html();
|
||||
|
||||
if(data != originalData) {
|
||||
swal({
|
||||
@@ -62,7 +72,8 @@ Template.AppreciationEditor.helpers({
|
||||
|
||||
Template.AppreciationEditor.events({
|
||||
'click #save': function(event, template) {
|
||||
let data = template.ckEditor.getData();
|
||||
// let data = template.ckEditor.getData();
|
||||
let data = $('.editor').html();
|
||||
|
||||
if(data != originalData) {
|
||||
Meteor.call('updatePage', 'Appreciation', data, function (error, result) {
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<template name="BoardEditor">
|
||||
<div id="boardEditor" >
|
||||
<div id="boardEditor">
|
||||
<h1>Current Board Editor</h1>
|
||||
<div id="editor"></div>
|
||||
<button id="save">Save</button>
|
||||
</div>
|
||||
</template>
|
||||
6
imports/ui/Admin/BoardEditor.import.styl
vendored
6
imports/ui/Admin/BoardEditor.import.styl
vendored
@@ -1,2 +1,6 @@
|
||||
#boardEditor
|
||||
display: block
|
||||
display: block
|
||||
.ck.ck-editor__editable_inline
|
||||
border-color: rgba(0,0,0,.2)
|
||||
.ck.ck-editor__editable_inline.ck-focused
|
||||
border-color: rgba(0,0,0,1)
|
||||
@@ -1,2 +1,69 @@
|
||||
|
||||
import './BoardEditor.html';
|
||||
import CKEditor from '@ckeditor/ckeditor5-build-balloon';
|
||||
import './BoardEditor.html';
|
||||
import swal from "sweetalert2";
|
||||
|
||||
let originalData = "";
|
||||
|
||||
Tracker.autorun(function() {
|
||||
Meteor.subscribe("pages");
|
||||
});
|
||||
|
||||
Template.BoardEditor.onRendered(function() {
|
||||
let _this = this;
|
||||
|
||||
CKEditor.create(document.querySelector('#editor'), {}).then(editor => {
|
||||
_this.ckEditor = editor;
|
||||
|
||||
Tracker.autorun(function() {
|
||||
let doc = Meteor.collections.Pages.findOne({name: 'Board'});
|
||||
|
||||
originalData = (doc === undefined ? "" : doc.html);
|
||||
editor.setData(originalData);
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
|
||||
Template.BoardEditor.onDestroyed(function() {
|
||||
let data = this.ckEditor.getData();
|
||||
|
||||
if(data != originalData) {
|
||||
swal({
|
||||
title: "Save Changes",
|
||||
text: "Would you like to save any changes you have made to this sheet?",
|
||||
type: "question",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#7cdd7f",
|
||||
confirmButtonText: "Yes",
|
||||
cancelButtonText: "No"
|
||||
}).then(
|
||||
function(isConfirm) {
|
||||
if(isConfirm) {
|
||||
Meteor.call('updatePage', 'Board', data, function (error, result) {
|
||||
if (error) sAlert.error(error);
|
||||
else sAlert.success("Content Saved Successfully");
|
||||
});
|
||||
}
|
||||
},
|
||||
function(dismiss) {}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Template.BoardEditor.events({
|
||||
'click #save': function(event, template) {
|
||||
let data = template.ckEditor.getData();
|
||||
|
||||
if(data != originalData) {
|
||||
Meteor.call('updatePage', 'Board', data, function (error, result) {
|
||||
if (error) sAlert.error(error);
|
||||
else sAlert.success("Content Saved Successfully");
|
||||
});
|
||||
}
|
||||
else {
|
||||
sAlert.success("Data has not changed!");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<template name="DatesEditor">
|
||||
<div id="datesEditor">
|
||||
<h1>Important Dates Editor</h1>
|
||||
<div id="editor"></div>
|
||||
<button id="save">Save</button>
|
||||
</div>
|
||||
</template>
|
||||
6
imports/ui/Admin/DatesEditor.import.styl
vendored
6
imports/ui/Admin/DatesEditor.import.styl
vendored
@@ -1,2 +1,6 @@
|
||||
#datesEditor
|
||||
display: block
|
||||
display: block
|
||||
.ck.ck-editor__editable_inline
|
||||
border-color: rgba(0,0,0,.2)
|
||||
.ck.ck-editor__editable_inline.ck-focused
|
||||
border-color: rgba(0,0,0,1)
|
||||
@@ -1,2 +1,70 @@
|
||||
|
||||
import './DatesEditor.html';
|
||||
import CKEditor from '@ckeditor/ckeditor5-build-balloon';
|
||||
import './DatesEditor.html';
|
||||
import swal from "sweetalert2";
|
||||
|
||||
let originalData = "";
|
||||
|
||||
Tracker.autorun(function() {
|
||||
Meteor.subscribe("pages");
|
||||
});
|
||||
|
||||
Template.DatesEditor.onRendered(function() {
|
||||
let _this = this;
|
||||
|
||||
CKEditor.create(document.querySelector('#editor'), {}).then(editor => {
|
||||
_this.ckEditor = editor;
|
||||
|
||||
Tracker.autorun(function() {
|
||||
let doc = Meteor.collections.Pages.findOne({name: 'Dates'});
|
||||
|
||||
originalData = (doc === undefined ? "" : doc.html);
|
||||
editor.setData(originalData);
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
|
||||
Template.DatesEditor.onDestroyed(function() {
|
||||
let data = this.ckEditor.getData();
|
||||
|
||||
if(data != originalData) {
|
||||
swal({
|
||||
title: "Save Changes",
|
||||
text: "Would you like to save any changes you have made to this sheet?",
|
||||
type: "question",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#7cdd7f",
|
||||
confirmButtonText: "Yes",
|
||||
cancelButtonText: "No"
|
||||
}).then(
|
||||
function(isConfirm) {
|
||||
if(isConfirm) {
|
||||
Meteor.call('updatePage', 'Dates', data, function (error, result) {
|
||||
if (error) sAlert.error(error);
|
||||
else sAlert.success("Content Saved Successfully");
|
||||
});
|
||||
}
|
||||
},
|
||||
function(dismiss) {}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Template.DatesEditor.events({
|
||||
'click #save': function(event, template) {
|
||||
let data = template.ckEditor.getData();
|
||||
|
||||
if(data != originalData) {
|
||||
Meteor.call('updatePage', 'Dates', data, function (error, result) {
|
||||
if (error) sAlert.error(error);
|
||||
else sAlert.success("Content Saved Successfully");
|
||||
});
|
||||
}
|
||||
else {
|
||||
sAlert.success("Data has not changed!");
|
||||
}
|
||||
}
|
||||
});
|
||||
s
|
||||
@@ -1,4 +1,7 @@
|
||||
<template name="NewsEditor">
|
||||
<div id="newsEditor">
|
||||
<h1>News Editor</h1>
|
||||
<div class="editor"></div>
|
||||
<button id="save">Save</button>
|
||||
</div>
|
||||
</template>
|
||||
6
imports/ui/Admin/NewsEditor.import.styl
vendored
6
imports/ui/Admin/NewsEditor.import.styl
vendored
@@ -1,2 +1,6 @@
|
||||
#newsEditor
|
||||
display: block
|
||||
display: block
|
||||
.ck.ck-editor__editable_inline
|
||||
border-color: rgba(0,0,0,.2)
|
||||
.ck.ck-editor__editable_inline.ck-focused
|
||||
border-color: rgba(0,0,0,1)
|
||||
@@ -1,2 +1,87 @@
|
||||
|
||||
import './NewsEditor.html';
|
||||
import CKEditor from '@ckeditor/ckeditor5-build-balloon';
|
||||
import './NewsEditor.html';
|
||||
import swal from "sweetalert2";
|
||||
|
||||
let originalData = "";
|
||||
|
||||
Tracker.autorun(function() {
|
||||
Meteor.subscribe("pages");
|
||||
});
|
||||
|
||||
Template.NewsEditor.onRendered(function() {
|
||||
let _this = this;
|
||||
|
||||
//#appreciationEditor'
|
||||
// CKEditor.create(document.querySelector('#editor'), {}).then(editor => {
|
||||
// _this.ckEditor = editor;
|
||||
//
|
||||
// Tracker.autorun(function() {
|
||||
// let doc = Meteor.collections.Pages.findOne({name: 'Appreciation'});
|
||||
//
|
||||
// originalData = (doc === undefined ? "" : doc.html);
|
||||
// editor.setData(originalData);
|
||||
// });
|
||||
// }).catch(err => {
|
||||
// console.error(err);
|
||||
// });
|
||||
$('.editor').tinymce({
|
||||
inline: true
|
||||
});
|
||||
Tracker.autorun(function() {
|
||||
let doc = Meteor.collections.Pages.findOne({name: 'News'});
|
||||
|
||||
originalData = (doc === undefined ? "" : doc.html);
|
||||
$('.editor').html(originalData);
|
||||
});
|
||||
});
|
||||
|
||||
Template.NewsEditor.onDestroyed(function() {
|
||||
let data = this.ckEditor.getData();
|
||||
|
||||
if(data != originalData) {
|
||||
swal({
|
||||
title: "Save Changes",
|
||||
text: "Would you like to save any changes you have made to this sheet?",
|
||||
type: "question",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#7cdd7f",
|
||||
confirmButtonText: "Yes",
|
||||
cancelButtonText: "No"
|
||||
}).then(
|
||||
function(isConfirm) {
|
||||
if(isConfirm) {
|
||||
Meteor.call('updatePage', 'News', data, function (error, result) {
|
||||
if (error) sAlert.error(error);
|
||||
else sAlert.success("Content Saved Successfully");
|
||||
});
|
||||
}
|
||||
},
|
||||
function(dismiss) {}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Template.NewsEditor.helpers({
|
||||
// html: function() {
|
||||
// let doc = Meteor.collections.Pages.findOne({name: 'News'});
|
||||
//
|
||||
// return doc == undefined ? "" : doc.html;
|
||||
// }
|
||||
});
|
||||
|
||||
Template.NewsEditor.events({
|
||||
'click #save': function(event, template) {
|
||||
let data = template.ckEditor.getData();
|
||||
|
||||
if(data != originalData) {
|
||||
Meteor.call('updatePage', 'News', data, function (error, result) {
|
||||
if (error) sAlert.error(error);
|
||||
else sAlert.success("Content Saved Successfully");
|
||||
});
|
||||
}
|
||||
else {
|
||||
sAlert.success("Data has not changed!");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user