mirror of
https://github.com/documize/community.git
synced 2025-07-22 22:59:43 +02:00
tab edit mode
This commit is contained in:
parent
3965f6e94c
commit
9fe115a9bd
13 changed files with 126 additions and 106 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Documize Community Edition
|
# Documize Community Edition
|
||||||
|
|
||||||
Modern Wiki + Docs integrating data from SaaS tools.
|
The Document IDE for wikis and documents.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ The mission is to bring software dev inspired features (refactoring, testing, li
|
||||||
|
|
||||||
## Latest version
|
## Latest version
|
||||||
|
|
||||||
v0.30.0
|
v0.31.0
|
||||||
|
|
||||||
## OS Support
|
## OS Support
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,12 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||||
viewMode: true,
|
viewMode: true,
|
||||||
editMode: false,
|
editMode: false,
|
||||||
|
|
||||||
|
didReceiveAttrs(){
|
||||||
|
if (this.get('mode') === 'edit') {
|
||||||
|
this.send('onEdit');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onEdit() {
|
onEdit() {
|
||||||
this.set('viewMode', false);
|
this.set('viewMode', false);
|
||||||
|
|
|
@ -65,10 +65,9 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
let code = window.location.search;
|
let code = window.location.search;
|
||||||
|
|
||||||
if (is.not.undefined(code) && is.not.null(code) && is.not.empty(code) && code !== "") {
|
if (is.not.undefined(code) && is.not.null(code) && is.not.empty(code) && code !== "") {
|
||||||
let tok = code.replace("?code=", "");
|
let tok = code.replace("?mode=edit&code=", "");
|
||||||
self.get('sectionService').fetch(page, "saveSecret", { "token": tok })
|
self.get('sectionService').fetch(page, "saveSecret", { "token": tok })
|
||||||
.then(function () {
|
.then(function () {
|
||||||
console.log("github auth code saved to db");
|
|
||||||
self.send('authStage2');
|
self.send('authStage2');
|
||||||
}, function (error) { //jshint ignore: line
|
}, function (error) { //jshint ignore: line
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -81,7 +80,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
}
|
}
|
||||||
self.get('sectionService').fetch(page, "checkAuth", self.get('config'))
|
self.get('sectionService').fetch(page, "checkAuth", self.get('config'))
|
||||||
.then(function () {
|
.then(function () {
|
||||||
console.log("github auth code valid");
|
|
||||||
self.send('authStage2');
|
self.send('authStage2');
|
||||||
}, function (error) { //jshint ignore: line
|
}, function (error) { //jshint ignore: line
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -212,11 +210,12 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
let self = this;
|
let self = this;
|
||||||
self.set('busy', true);
|
self.set('busy', true);
|
||||||
self.set('authenticated', false);
|
self.set('authenticated', false);
|
||||||
|
|
||||||
let target = "https://github.com/login/oauth/authorize?client_id=" + self.get('config.clientId') +
|
let target = "https://github.com/login/oauth/authorize?client_id=" + self.get('config.clientId') +
|
||||||
"&scope=repo&redirect_uri=" + encodeURIComponent(self.get('config.callbackUrl')) +
|
"&scope=repo&redirect_uri=" + encodeURIComponent(self.get('config.callbackUrl')) +
|
||||||
"&state=" + encodeURIComponent(window.location.href);
|
"&state=" + encodeURIComponent(window.location.href);
|
||||||
window.location.href = target;
|
|
||||||
|
|
||||||
|
window.location.href = target;
|
||||||
},
|
},
|
||||||
|
|
||||||
onOwnerChange(thisOwner) {
|
onOwnerChange(thisOwner) {
|
||||||
|
|
|
@ -83,6 +83,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
error(error /*, transition*/ ) {
|
error(error /*, transition*/ ) {
|
||||||
|
console.log(error);
|
||||||
if (error) {
|
if (error) {
|
||||||
this.transitionTo('/not-found');
|
this.transitionTo('/not-found');
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -14,6 +14,8 @@ import NotifierMixin from '../../../mixins/notifier';
|
||||||
|
|
||||||
export default Ember.Controller.extend(NotifierMixin, {
|
export default Ember.Controller.extend(NotifierMixin, {
|
||||||
documentService: Ember.inject.service('document'),
|
documentService: Ember.inject.service('document'),
|
||||||
|
queryParams: ['mode'],
|
||||||
|
mode: null,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onAction(page, meta) {
|
onAction(page, meta) {
|
||||||
|
|
|
@ -17,6 +17,15 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||||
folderService: Ember.inject.service('folder'),
|
folderService: Ember.inject.service('folder'),
|
||||||
userService: Ember.inject.service('user'),
|
userService: Ember.inject.service('user'),
|
||||||
pageId: '',
|
pageId: '',
|
||||||
|
queryParams: {
|
||||||
|
mode: {
|
||||||
|
refreshModel: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeModel(transition) {
|
||||||
|
this.set('mode', !_.isUndefined(transition.queryParams.mode) ? transition.queryParams.mode : '');
|
||||||
|
},
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{{document/document-tab model=model onAction=(action 'onAction') onDelete=(action 'onDelete')}}
|
{{document/document-tab mode=mode model=model onAction=(action 'onAction') onDelete=(action 'onDelete')}}
|
||||||
|
|
|
@ -40,12 +40,9 @@ export default Ember.Controller.extend(NotifierMixin, {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.get('documentService').addPage(this.get('model.document.id'), model).then((newPage) => {
|
this.get('documentService').addPage(this.get('model.document.id'), model).then((newPage) => {
|
||||||
this.transitionToRoute('document.section',
|
let options = {};
|
||||||
this.get('model.folder.id'),
|
options['mode'] = 'edit';
|
||||||
this.get('model.folder.slug'),
|
this.transitionToRoute('document.section', newPage.id, { queryParams: options });
|
||||||
this.get('model.document.id'),
|
|
||||||
this.get('model.document.slug'),
|
|
||||||
newPage.id);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,12 +124,16 @@ export default Ember.Service.extend({
|
||||||
updatePage: function (documentId, pageId, payload, skipRevision) {
|
updatePage: function (documentId, pageId, payload, skipRevision) {
|
||||||
var revision = skipRevision ? "?r=true" : "?r=false";
|
var revision = skipRevision ? "?r=true" : "?r=false";
|
||||||
let url = `documents/${documentId}/pages/${pageId}${revision}`;
|
let url = `documents/${documentId}/pages/${pageId}${revision}`;
|
||||||
|
|
||||||
Ember.set(payload.meta, 'id', parseInt(payload.meta.id));
|
Ember.set(payload.meta, 'id', parseInt(payload.meta.id));
|
||||||
|
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: JSON.stringify(payload),
|
data: JSON.stringify(payload),
|
||||||
contentType: 'json'
|
contentType: 'json'
|
||||||
|
}).then((response) => {
|
||||||
|
let data = this.get('store').normalize('page', response);
|
||||||
|
return this.get('store').push(data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -140,6 +144,9 @@ export default Ember.Service.extend({
|
||||||
return this.get('ajax').post(url, {
|
return this.get('ajax').post(url, {
|
||||||
data: JSON.stringify(payload),
|
data: JSON.stringify(payload),
|
||||||
contentType: 'json'
|
contentType: 'json'
|
||||||
|
}).then((response) => {
|
||||||
|
let data = this.get('store').normalize('page', response);
|
||||||
|
return this.get('store').push(data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "documize",
|
"name": "documize",
|
||||||
"version": "0.30.0",
|
"version": "0.31.0",
|
||||||
"description": "The Documentation IDE",
|
"description": "The Document IDE",
|
||||||
"private": true,
|
"private": true,
|
||||||
"directories": {
|
"directories": {
|
||||||
"doc": "doc",
|
"doc": "doc",
|
||||||
|
|
|
@ -26,7 +26,7 @@ type ProdInfo struct {
|
||||||
// Product returns product edition details
|
// Product returns product edition details
|
||||||
func Product() (p ProdInfo) {
|
func Product() (p ProdInfo) {
|
||||||
p.Major = "0"
|
p.Major = "0"
|
||||||
p.Minor = "30"
|
p.Minor = "31"
|
||||||
p.Patch = "0"
|
p.Patch = "0"
|
||||||
p.Version = fmt.Sprintf("%s.%s.%s", p.Major, p.Minor, p.Patch)
|
p.Version = fmt.Sprintf("%s.%s.%s", p.Major, p.Minor, p.Patch)
|
||||||
p.Edition = "Community"
|
p.Edition = "Community"
|
||||||
|
|
|
@ -102,7 +102,7 @@ func Callback(res http.ResponseWriter, req *http.Request) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
target := up.Scheme + "://" + up.Host + up.Path + "?code=" + gt.AccessToken
|
target := up.Scheme + "://" + up.Host + up.Path + "?mode=edit&code=" + gt.AccessToken
|
||||||
|
|
||||||
http.Redirect(res, req, target, http.StatusTemporaryRedirect)
|
http.Redirect(res, req, target, http.StatusTemporaryRedirect)
|
||||||
|
|
||||||
|
|
|
@ -85,9 +85,8 @@ const commitsTemplate = `
|
||||||
</td>
|
</td>
|
||||||
<td class="right-column">
|
<td class="right-column">
|
||||||
<div class="contributor-meta">
|
<div class="contributor-meta">
|
||||||
<img class="github-avatar" alt="@{{$commit.Name}}" src="{{$commit.Avatar}}" />
|
<img class="github-avatar" title="@{{$commit.Name}}" alt="@{{$commit.Name}}" src="{{$commit.Avatar}}" />
|
||||||
{{$commit.Name}}
|
{{$commit.Date}}
|
||||||
· {{$commit.Date}}
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue