Code Blocks

.codeblock
Used as a wrapping element around .code-header and .code-body. Used to show the content of a file or a Gist.
.diffblock
Used as a wrapping element to show a diff in a Commit or Pull Request page. Contains usually .code-header, .code-body and in the edit case a .message.

Code Blocks are used in the following areas:

  • Commit: Showing the Diff (still called Changeset in a few places).
  • File: Display a file, annotations, and edit a file.
  • Gist: Show the Gist and edit it.
  • Pull Request: Display the Diff of a Pull Request.

Compare Commits

... ...
@@ -391,7 +391,7 @@
391 391
}  /* Existing line, it might have a quite long content actually and in this case we might need some horizontal scrolling. The remaining text here is just used to make this line very long.
392 392

  
393 393
.code-body.textarea.editor,
394
div.code-body{
394
div.code-body {
395 395
    float: left;
396 396
    position: relative;
397 397
    max-width: none;
... ...
@@ -399,3 +399,6 @@
399 399
    box-sizing: border-box;
400 400
}
401 401

  
402
.code-body td{
403
    line-height: 1.2em;
404
}
... ...
 No newline at end of file

Pull Request

rhodecode/public/css/main.less Unified Diff | Side-by-side Diff
1
2
... ...
@@ -2110,7 +2110,6 @@
2110 2110
  width: auto !important;
2111 2111
  min-width: 160px;
2112 2112
  margin: @padding @padding @padding 0;
2113
  padding: .9em;  /* Old comment which was making this line a very long line so that we might have to deal with it by either adding horizontal scrolling or some smart way of breaking this line. */
2114 2113
    line-height: 1em;
2115 2114
  z-index: 100;//js sets the menu below it to 9999
2116 2115
  background-color: white;
... ...
@@ -2118,7 +2117,7 @@
2118 2117

  
2119 2118
  a {
2120 2119
    display:block;
2121
   class="tab-escape">  padding: 0;
2120
      padding: .9em;
2122 2121

  
2123 2122
    &:after {
2124 2123
      content: "\00A0\25BE";
##TODO: lisa: I believe this needs to be updated as the layout has changed.

File View

gravatar
Marcin Kuzminski - 6m and 12d ago
License changes
# Published under Business Source License.
# Read the full license text at https://rhodecode.com/licenses.
"""
rhodecode.websetup
~~~~~~~~~~~~~~~~~~
Weboperations and setup for rhodecode. Intentionally long line to show what will happen if this line does not fit onto the screen. It might have some horizontal scrolling applied or some other fancy mechanism to deal with it.
:created_on: Dec 11, 2010
:author: marcink
:copyright: (c) 2013-2015 RhodeCode GmbH.
:license: Business Source License, see LICENSE for more details.
"""
import logging
from rhodecode.config.environment import load_environment
from rhodecode.lib.db_manage import DbManage
from rhodecode.model.meta import Session
log = logging.getLogger(__name__)
def setup_app(command, conf, vars):
"""Place any commands to setup rhodecode here"""
dbconf = conf['sqlalchemy.db1.url']
dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'],
tests=False, cli_args=command.options.__dict__)
dbmanage.create_tables(override=True)
dbmanage.set_db_version()
opts = dbmanage.config_prompt(None)
dbmanage.create_settings(opts)
dbmanage.create_default_user()
dbmanage.admin_prompt()
dbmanage.create_permissions()
dbmanage.populate_default_permissions()
Session().commit()
load_environment(conf.global_conf, conf.local_conf, initial=True)
DbManage.check_waitress()

Gist Edit

47
1
import re
2
 
3
from django.utils.text import compress_sequence, compress_string
4
from django.utils.cache import patch_vary_headers
5
 
6
re_accepts_gzip = re.compile(r'\bgzip\b')
7
 
8
 
9
class GZipMiddleware(object): # Intentionally long line to show what will happen if this line does not fit onto the screen. It might have some horizontal scrolling applied or some other fancy mechanism to deal with it.
10
    """
11
    This middleware compresses content if the browser allows gzip compression.
12
    It sets the Vary header accordingly, so that caches will base their storage
13
    on the Accept-Encoding header.
14
    """
15
    def process_response(self, request, response):
16
        # It's not worth attempting to compress really short responses.
17
        if not response.streaming and len(response.content) < 200:
18
            return response
19
 
20
        # Avoid gzipping if we've already got a content-encoding.
21
        if response.has_header('Content-Encoding'):
22
            return response
23
 
24
        patch_vary_headers(response, ('Accept-Encoding',))
25
 
26
        ae = request.META.get('HTTP_ACCEPT_ENCODING', '')
27
        if not re_accepts_gzip.search(ae):
28
            return response
29
 
30
        if response.streaming:
31
            # Delete the `Content-Length` header for streaming content, because
32
            # we won't know the compressed size until we stream it.
33
            response.streaming_content = compress_sequence(response.streaming_content)
34
            del response['Content-Length']
35
        else:
36
            # Return the compressed content only if it's actually shorter.
37
            compressed_content = compress_string(response.content)
38
            if len(compressed_content) >= len(response.content):
39
                return response
40
            response.content = compressed_content
41
            response['Content-Length'] = str(len(response.content))
42
 
43
        if response.has_header('ETag'):
44
            response['ETag'] = re.sub('"$', ';gzip"', response['ETag'])
45
        response['Content-Encoding'] = 'gzip'
46
 
47
        return response
 

File Edit

rhodecode /
plain
off

                
1
2
 
3
# Published under Commercial License.
4
# Read the full license text at https://rhodecode.com/licenses.
5
"""
6
rhodecode.websetup
7
~~~~~~~~~~~~~~~~~~
8
 
9
Weboperations and setup for rhodecode
10
 
11
:created_on: Dec 11, 2010
12
:author: marcink
13
:copyright: (c) 2013-2015 RhodeCode GmbH.
14
:license: Commercial License, see LICENSE for more details.
15
"""
16
 
17
import logging
18
 
19
from rhodecode.config.environment import load_environment
20
from rhodecode.lib.db_manage import DbManage
21
from rhodecode.model.meta import Session
22
 
23
 
24
log = logging.getLogger(__name__)  # Intentionally long line to show what will happen if this line does not fit onto the screen. It might have some horizontal scrolling applied or some other fancy mechanism to deal with it.
25
 
26
 
27
def setup_app(command, conf, vars):
28
    """Place any commands to setup rhodecode here"""
29
    dbconf = conf['sqlalchemy.db1.url']
30
    dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'],
31
                        tests=False, cli_args=command.options.__dict__)
32
    dbmanage.create_tables(override=True)
33
    dbmanage.set_db_version()
34
    opts = dbmanage.config_prompt(None)
35
    dbmanage.create_settings(opts)
36
    dbmanage.create_default_user()
37
    dbmanage.admin_prompt()
38
    dbmanage.create_permissions()
39
    dbmanage.populate_default_permissions()
40
    Session().commit()
41
    load_environment(conf.global_conf, conf.local_conf, initial=True)
42
 
 

Commit with comments

... ...
@@ -59,7 +59,7 @@
59 59
                'tag': 'v0.2.0',
60 60
                'branch': 'default',
61 61
                'response':  # Intentionally long line to show what will happen if this line does not fit onto the screen. It might have some horizontal scrolling applied or some other fancy mechanism to deal with it.
62
                   '147 files changed: 5700 inserted, 10176 deleted'
62
                    '147 files changed: 5700 inserted, 10176 deleted'
63 63
            },
64 64
            'git': {
65 65
                'tag': 'v0.2.2',
... ...
@@ -77,9 +77,11 @@
77 77
            target_ref=revisions[backend.alias]['tag'],
78 78
            ))
anderson just now | Comment on commit

commented line with multiple lines

Add another comment
79 79

  
80
        response.mustcontain('%s@%s' % (backend.repo_name,
Submitting...
Commenting on line o80.
Comments parsed using RST syntax with @mention support.
Preview
80
        response.mustcontain('%s@%s' % (
81
            backend.repo_name,
81 82
            revisions[backend.alias]['branch']))
82
        response.mustcontain('%s@%s' % (backend.repo_name,
83
        response.mustcontain('%s@%s' % (
84
            backend.repo_name,
83 85
            revisions[backend.alias]['tag']))
84 86
        response.mustcontain(revisions[backend.alias]['response'])
85 87

  

Side-by-side diff

tests/test_basic_api.py [mode: python]
r1538:de45f950b669 ... r1539:ea295cfb6226