From c1f3008d03a933b76580a47547ef971aa4e639d7 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Thu, 14 Mar 2013 10:04:18 -0700 Subject: [PATCH 1/4] Redesigned directory pages (WIP) This is an initial conversion of the directory pages from the old style to the new style which is based on Twitter Bootstrap. Still some remaining work to be done. You can see a screenshot here: http://i.imgur.com/MPEngGx.png --- src/allmydata/web/directory.py | 4 +- src/allmydata/web/directory.xhtml | 117 +++++++++++++++++++----------- 2 files changed, 78 insertions(+), 43 deletions(-) diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index 21f6d429c..ec170e8b2 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -686,14 +686,14 @@ class DirectoryAsHTML(rend.Page): T.input(type='hidden', name='t', value='unlink'), T.input(type='hidden', name='name', value=name), T.input(type='hidden', name='when_done', value="."), - T.input(type='submit', value='unlink', name="unlink"), + T.input(type='submit', _class='btn', value='unlink', name="unlink"), ] rename = T.form(action=here, method="get")[ T.input(type='hidden', name='t', value='rename-form'), T.input(type='hidden', name='name', value=name), T.input(type='hidden', name='when_done', value="."), - T.input(type='submit', value='rename/relink', name="rename"), + T.input(type='submit', _class='btn', value='rename/relink', name="rename"), ] ctx.fillSlots("unlink", unlink) diff --git a/src/allmydata/web/directory.xhtml b/src/allmydata/web/directory.xhtml index 540da00d9..ee94d5814 100644 --- a/src/allmydata/web/directory.xhtml +++ b/src/allmydata/web/directory.xhtml @@ -1,50 +1,85 @@ - - - - - - + + + + + + + + -

+ + + + -
-
- + + + - -
-
+ + -
- - - - - - - - - - - - - - - - - - - +
+
+ +
+

-
+
+
TypeFilenameSizeTimes
This directory is empty.
+ + + + + + + + + + + + + + + + + + -
TypeFilenameSizeTimes
-
+ This directory is empty. - + + \ No newline at end of file From 61395328c38573f6250b9aba70ae4b020c391e26 Mon Sep 17 00:00:00 2001 From: Leif Ryge Date: Sat, 27 Apr 2013 08:49:07 +0000 Subject: [PATCH 2/4] make tests pass with redesigned directory pages --- src/allmydata/test/test_web.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 077ea0286..66e7fd15a 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -50,7 +50,7 @@ unknown_rocap = u"ro.lafs://readonly_from_the_future_ro_\u263A".encode('utf-8') unknown_immcap = u"imm.lafs://immutable_from_the_future_imm_\u263A".encode('utf-8') FAVICON_MARKUP = '' - +DIR_HTML_TAG = '' class FakeStatsProvider: def get_stats(self): @@ -1522,7 +1522,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi def test_GET_DIRECTORY_html(self): d = self.GET(self.public_url + "/foo", followRedirect=True) def _check(html): - self.failUnlessIn('', html) + self.failUnlessIn('
  • Return to Welcome page
  • ', html) self._check_upload_and_mkdir_forms(html) self.failUnlessIn("quux", html) d.addCallback(_check) @@ -5590,7 +5590,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi d.addCallback(lambda ignored: self.GET(self.fileurls["dir-0share"])) def _check_0shares_dir_html(body): - self.failUnlessIn("", body) + self.failUnlessIn(DIR_HTML_TAG, body) # we should see the regular page, but without the child table or # the dirops forms body = " ".join(body.strip().split()) @@ -5613,7 +5613,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi # and some-shares like we did for immutable files (since there # are different sorts of advice to offer in each case). For now, # they present the same way. - self.failUnlessIn("", body) + self.failUnlessIn(DIR_HTML_TAG, body) body = " ".join(body.strip().split()) self.failUnlessIn('href="?t=info">More info on this directory', body) @@ -5740,7 +5740,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi d.addCallback(_stash_dir) d.addCallback(lambda ign: self.GET(self.dir_url, followRedirect=True)) def _check_dir_html(body): - self.failUnlessIn("", body) + self.failUnlessIn(DIR_HTML_TAG, body) self.failUnlessIn("blacklisted.txt", body) d.addCallback(_check_dir_html) d.addCallback(lambda ign: self.GET(self.url)) @@ -5764,7 +5764,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi # We should still be able to list the parent directory, in HTML... d.addCallback(lambda ign: self.GET(self.dir_url, followRedirect=True)) def _check_dir_html2(body): - self.failUnlessIn("", body) + self.failUnlessIn(DIR_HTML_TAG, body) self.failUnlessIn("blacklisted.txt", body) d.addCallback(_check_dir_html2) @@ -5815,7 +5815,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi self.child_url = "uri/"+dn.get_readonly_uri()+"/child" d.addCallback(_get_dircap) d.addCallback(lambda ign: self.GET(self.dir_url_base, followRedirect=True)) - d.addCallback(lambda body: self.failUnlessIn("", body)) + d.addCallback(lambda body: self.failUnlessIn(DIR_HTML_TAG, body)) d.addCallback(lambda ign: self.GET(self.dir_url_json1)) d.addCallback(lambda res: simplejson.loads(res)) # just check it decodes d.addCallback(lambda ign: self.GET(self.dir_url_json2)) From 52859423ba97c079edf24c321f0e5c21eff1b65f Mon Sep 17 00:00:00 2001 From: "Mark J. Berger" Date: Fri, 30 Aug 2013 10:03:58 -0400 Subject: [PATCH 3/4] Updates webui directory forms --- src/allmydata/test/test_web.py | 2 +- src/allmydata/web/directory.py | 40 +++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 66e7fd15a..52c53b5b3 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -1616,7 +1616,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d.addCallback(lambda res: self.GET(self.public_url + "/foo/empty/")) def _check4(res): self.failUnlessIn("directory is empty", res) - MKDIR_BUTTON_RE=re.compile('.*Create a new directory in this directory.*', re.I) + MKDIR_BUTTON_RE=re.compile('.*Create a new directory in this directory.*', re.I) self.failUnless(MKDIR_BUTTON_RE.search(res), res) d.addCallback(_check4) diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index ec170e8b2..340591b60 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -815,11 +815,13 @@ class DirectoryAsHTML(rend.Page): T.input(type="hidden", name="t", value="mkdir"), T.input(type="hidden", name="when_done", value="."), T.legend(class_="freeform-form-label")["Create a new directory in this directory"], - "New directory name:"+SPACE, + "New directory name:"+SPACE, T.br, T.input(type="text", name="name"), SPACE, - T.input(type="submit", value="Create"), SPACE*2, - mkdir_sdmf, T.label(for_='mutable-directory-sdmf')[" SDMF"], SPACE, - mkdir_mdmf, T.label(for_='mutable-directory-mdmf')[" MDMF (experimental)"], + T.div(class_="form-inline")[ + mkdir_sdmf, T.label(for_='mutable-directory-sdmf')[SPACE, "SDMF"], SPACE*2, + mkdir_mdmf, T.label(for_='mutable-directory-mdmf')[SPACE, "MDMF (experimental)"] + ], + T.input(type="submit", class_="btn", value="Create") ]] forms.append(T.div(class_="freeform-form")[mkdir_form]) @@ -839,25 +841,27 @@ class DirectoryAsHTML(rend.Page): T.legend(class_="freeform-form-label")["Upload a file to this directory"], "Choose a file to upload:"+SPACE, T.input(type="file", name="file", class_="freeform-input-file"), SPACE, - T.input(type="submit", value="Upload"), SPACE*2, - upload_chk, T.label(for_="upload-chk") [" Immutable"], SPACE, - upload_sdmf, T.label(for_="upload-sdmf")[" SDMF"], SPACE, - upload_mdmf, T.label(for_="upload-mdmf")[" MDMF (experimental)"], + T.div(class_="form-inline")[ + upload_chk, T.label(for_="upload-chk") [SPACE, "Immutable"], SPACE*2, + upload_sdmf, T.label(for_="upload-sdmf")[SPACE, "SDMF"], SPACE*2, + upload_mdmf, T.label(for_="upload-mdmf")[SPACE, "MDMF (experimental)"] + ], + T.input(type="submit", class_="btn", value="Upload"), SPACE*2, ]] forms.append(T.div(class_="freeform-form")[upload_form]) attach_form = T.form(action=".", method="post", enctype="multipart/form-data")[ - T.fieldset[ - T.input(type="hidden", name="t", value="uri"), - T.input(type="hidden", name="when_done", value="."), - T.legend(class_="freeform-form-label")["Add a link to a file or directory which is already in Tahoe-LAFS."], - "New child name:"+SPACE, - T.input(type="text", name="name"), SPACE*2, - "URI of new child:"+SPACE, - T.input(type="text", name="uri"), SPACE, - T.input(type="submit", value="Attach"), - ]] + T.fieldset[ T.div(class_="form-inline")[ + T.input(type="hidden", name="t", value="uri"), + T.input(type="hidden", name="when_done", value="."), + T.legend(class_="freeform-form-label")["Add a link to a file or directory which is already in Tahoe-LAFS."], + "New child name:"+SPACE, + T.input(type="text", name="name"), SPACE*2, + "URI of new child:"+SPACE, + T.input(type="text", name="uri"), SPACE, + T.input(type="submit", class_="btn", value="Attach"), + ]]] forms.append(T.div(class_="freeform-form")[attach_form]) return forms From d7aef0cffb2a28465f75c883128e99045dadcb82 Mon Sep 17 00:00:00 2001 From: Leif Ryge Date: Fri, 30 Aug 2013 19:57:38 +0000 Subject: [PATCH 4/4] add a
    --- src/allmydata/web/directory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index 340591b60..4dfe36fa8 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -857,7 +857,7 @@ class DirectoryAsHTML(rend.Page): T.input(type="hidden", name="when_done", value="."), T.legend(class_="freeform-form-label")["Add a link to a file or directory which is already in Tahoe-LAFS."], "New child name:"+SPACE, - T.input(type="text", name="name"), SPACE*2, + T.input(type="text", name="name"), SPACE*2, T.br, "URI of new child:"+SPACE, T.input(type="text", name="uri"), SPACE, T.input(type="submit", class_="btn", value="Attach"),