Browse Source

Merge pull request #25 from lebouquetin/master

Tracim 9 years ago
parent
commit
91d6911eb3

+ 7 - 3
.travis.yml View File

@@ -1,3 +1,4 @@
1
+sudo: false
1 2
 language: python
2 3
 python:
3 4
   - "3.2"
@@ -20,13 +21,16 @@ install:
20 21
   - "pip install -r install/requirements.txt; echo"
21 22
   - "./bin/tg2env-patch 2 /home/travis/virtualenv/python3.2.5/lib/python3.2/site-packages"
22 23
   - "pip install coveralls"
23
-  
24
+
24 25
 before_script:
25 26
   - "psql -c 'create database tracim_test;' -U postgres"
26
-  - "cp tracim/development.ini.base tracim/development.ini"
27
+  - "cp ${TRAVIS_BUILD_DIR}/tracim/development.ini.base ${TRAVIS_BUILD_DIR}/tracim/development.ini"
28
+#  - "cd ${TRAVIS_BUILD_DIR}/tracim && gearbox setup-app -c ${TRAVIS_BUILD_DIR}/tracim/test.ini"
29
+  - "cd ${TRAVIS_BUILD_DIR}/tracim && gearbox setup-app"
30
+#  - "cd ${TRAVIS_BUILD_DIR}/tracim && gearbox migrate -c ${TRAVIS_BUILD_DIR}/tracim/test.ini upgrade"
27 31
 
28 32
 # command to run tests
29
-script: "cd tracim && nosetests -v --with-coverage --cover-package=tracim --cover-erase"
33
+script: "cd ${TRAVIS_BUILD_DIR}/tracim && nosetests -c ${TRAVIS_BUILD_DIR}/tracim/test.ini -v --with-coverage --cover-package=tracim --cover-erase"
30 34
 
31 35
 after_success:
32 36
 - coveralls

+ 2 - 1
tracim/development.ini.base View File

@@ -62,7 +62,8 @@ beaker.session.validate_key = 3283411b-1904-4554-b0e1-883863b53080
62 62
 # invalidate the URI when specifying a SQLite db via path name
63 63
 # sqlalchemy.url=postgresql://username:password@hostname:port/databasename
64 64
 # sqlalchemy.url=mysql://username:password@hostname:port/databasename
65
-sqlalchemy.url = postgresql://tracim_user:tracim_user_password@127.0.0.1:5432/tracim?client_encoding=utf8
65
+# sqlalchemy.url = postgresql://tracim_user:tracim_user_password@127.0.0.1:5432/tracim?client_encoding=utf8
66
+sqlalchemy.url = postgresql://postgres:dummy@127.0.0.1:5432/tracim_test?client_encoding=utf8
66 67
 
67 68
 #echo shouldn't be used together with the logging module.
68 69
 sqlalchemy.echo = false

+ 1 - 1
tracim/setup.py View File

@@ -47,7 +47,7 @@ setup(
47 47
     description='Tracim is plateform software designed to improve traceability and productivity in collaborative work.',
48 48
     author='Damien ACCORSI',
49 49
     author_email='damien.accorsi@free.fr',
50
-    url='https://bitbucket.org/lebouquetin/tracim',
50
+    url='https://github.com/tracim/tracim',
51 51
     packages=find_packages(exclude=['ez_setup']),
52 52
     install_requires=install_requires,
53 53
     include_package_data=True,

+ 31 - 3
tracim/tracim/lib/content.py View File

@@ -501,7 +501,7 @@ class ContentApi(object):
501 501
 
502 502
     def mark_read(self, content: Content,
503 503
                   read_datetime: datetime=None,
504
-                  do_flush=True) -> Content:
504
+                  do_flush: bool=True, recursive: bool=True) -> Content:
505 505
 
506 506
         assert self._user
507 507
         assert content
@@ -521,8 +521,23 @@ class ContentApi(object):
521 521
         for revision in viewed_revisions:
522 522
             revision.read_by[self._user] = read_datetime
523 523
 
524
-        for child in content.get_valid_children():
525
-            self.mark_read(child, read_datetime=read_datetime, do_flush=False)
524
+        if recursive:
525
+            # mark read :
526
+            # - all children
527
+            # - parent stuff (if you mark a comment as read,
528
+            #                 then you have seen the parent)
529
+            # - parent comments
530
+            for child in content.get_valid_children():
531
+                self.mark_read(child, read_datetime=read_datetime,
532
+                               do_flush=False)
533
+
534
+            if ContentType.Comment == content.type:
535
+                self.mark_read(content.parent, read_datetime=read_datetime,
536
+                               do_flush=False, recursive=False)
537
+                for comment in content.parent.get_comments():
538
+                    if comment != content:
539
+                        self.mark_read(comment, read_datetime=read_datetime,
540
+                                       do_flush=False, recursive=False)
526 541
 
527 542
         if do_flush:
528 543
             self.flush()
@@ -569,9 +584,22 @@ class ContentApi(object):
569 584
             content.revision_type = action_description
570 585
 
571 586
         if do_flush:
587
+            # INFO - 2015-09-03 - D.A.
588
+            # There are 2 flush because of the use
589
+            # of triggers for content creation
590
+            #
591
+            # (when creating a content, actually this is an insert of a new
592
+            # revision in content_revisions ; so the mark_read operation need
593
+            # to get full real data from database before to be prepared.
594
+
572 595
             DBSession.add(content)
573 596
             DBSession.flush()
574 597
 
598
+            # TODO - 2015-09-03 - D.A. - Do not use triggers
599
+            # We should create a new ContentRevisionRO object instead of Content
600
+            # This would help managing view/not viewed status
601
+            self.mark_read(content, do_flush=True)
602
+
575 603
         if do_notify:
576 604
             self.do_notify(content)
577 605
 

+ 2 - 0
tracim/tracim/public/assets/css/dashboard.css View File

@@ -360,3 +360,5 @@ tr.t-is-new-content td, div.row.t-is-new-content {
360 360
 }
361 361
 
362 362
 .panel-heading > h3 { font-size: 1.5em;}
363
+
364
+hr.t-toolbar-btn-group-separator { border-color: #CCC; border-style: dotted; }

+ 1 - 0
tracim/tracim/templates/file/toolbar.mak View File

@@ -6,6 +6,7 @@
6 6
     <div class="btn-group btn-group-vertical text-center">
7 7
         ${BUTTON.MARK_CONTENT_READ_OR_UNREAD(user, workspace, file)}
8 8
     </div>
9
+    <hr class="t-toolbar-btn-group-separator"/>
9 10
     <p></p>
10 11
 
11 12
     <% download_url = tg.url('/workspaces/{}/folders/{}/files/{}/download?revision_id={}'.format(result.file.workspace.id, result.file.parent.id,result.file.id,result.file.selected_revision)) %>

+ 1 - 1
tracim/tracim/templates/page/forms.mak View File

@@ -18,7 +18,7 @@
18 18
 
19 19
                 <div class="form-group">
20 20
                     <label for="page-content">${_('Content')}</label>
21
-                    <iframe id="page-content-textarea" name="content" class="form-control pod-rich-textarea" id="page-content" placeholder="${_('Write here the page content')}"></iframe>
21
+                    <textarea id="page-content-textarea" name="content" class="form-control pod-rich-textarea" id="page-content" placeholder="${_('Write here the page content')}"></textarea>
22 22
                 </div>
23 23
             </div>
24 24
             <div class="modal-footer">

+ 1 - 0
tracim/tracim/templates/page/toolbar.mak View File

@@ -5,6 +5,7 @@
5 5
     <div class="btn-group btn-group-vertical">
6 6
         ${BUTTON.MARK_CONTENT_READ_OR_UNREAD(user, workspace, page)}
7 7
     </div>
8
+    <hr class="t-toolbar-btn-group-separator"/>
8 9
     <p></p>
9 10
 
10 11
     <% edit_disabled = ('', 'disabled')[page.selected_revision!='latest' or page.status.id[:6]=='closed'] %>

+ 1 - 0
tracim/tracim/templates/thread/toolbar.mak View File

@@ -6,6 +6,7 @@
6 6
     <div class="btn-group btn-group-vertical">
7 7
         ${BUTTON.MARK_CONTENT_READ_OR_UNREAD(user, workspace, thread)}
8 8
     </div>
9
+    <hr class="t-toolbar-btn-group-separator"/>
9 10
     <p></p>
10 11
 
11 12
     <% edit_disabled = ('', 'disabled')[thread.selected_revision!='latest' or thread.status.id[:6]=='closed'] %>

+ 6 - 4
tracim/tracim/templates/widgets/button.mak View File

@@ -41,15 +41,17 @@
41 41
         if 'latest' != content.selected_revision:
42 42
             disabled_or_not = 'disabled'
43 43
     %>
44
+
44 45
     % if content.is_new:
45
-       <a href="${content.urls.mark_read}" class="btn btn-success ${disabled_or_not}" style="text-align: center;">
46
-           <i class="fa fa-4x fa-fw fa-eye"></i><br/>
46
+       <a href="${content.urls.mark_read}" class="btn btn-success ${disabled_or_not}">
47
+           <i class="fa fa-fw fa-inverse fa-eye"></i>
47 48
            <span style="color: #FFF">${_('Mark read')}</span>
48 49
        </a>
49 50
     % else:
50
-       <a href="${content.urls.mark_unread}" class="btn btn-default ${disabled_or_not}" style="text-align: center;">
51
-           <i class="fa fa-4x fa-fw fa-eye-slash tracim-less-visible"></i><br/>
51
+       <a href="${content.urls.mark_unread}" class="btn btn-default ${disabled_or_not}">
52
+           <i class="fa fa-fw fa-eye-slash t-less-visible"></i>
52 53
            <span class="tracim-less-visible">${_('Mark unread')}</span>
53 54
        </a>
54 55
     % endif
55 56
 </%def>
57
+

+ 3 - 0
tracim/tracim/websetup/schema.py View File

@@ -28,6 +28,9 @@ def setup_schema(command, conf, vars):
28 28
 
29 29
     # <websetup.websetup.schema.after.metadata.create_all>
30 30
     transaction.commit()
31
+    print("Create additionnal tables.")
32
+    model.metadata.create_all(bind=config['tg.app_globals'].sa_engine)
33
+
31 34
     print('Initializing Migrations')
32 35
     import alembic.config, alembic.command
33 36
     alembic_cfg = alembic.config.Config()