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