mwanji / essayist

A blogging app for the tent.io protocol
10 stars 2 forks source link

Make app title and default license configurable #65

Closed pjesi closed 11 years ago

pjesi commented 11 years ago

I started extracting attributes that I want to configure into the properties file. This batch includes the app's name and the default post license.

mwanji commented 11 years ago

Thanks! I'll look at this soon.

Thought I'd mention that I'll be focusing a lot more on Essayist very soon.

First task will be to use a proper web framework, as Guice-Servlet is making it messier than it needs to be.

pjesi commented 11 years ago

No worries. Looking forward to it.

My plan is to add support for custom domains and permalinks. This is the first task in that direction.

mwanji commented 11 years ago

What about custom domains doesn't work?

pjesi commented 11 years ago

I want to be able to serve essays as a website. So the user could specify a domain (either subdomain or a custom domain) that would serve his essays directly. It would work something like this:

  1. User logs into Essayist at example.com
  2. User goes to "settings"
  3. User enters a sub-domain in the settings, e.g., pjesi. Sub-domain is validated to be unique.
  4. Visitor visits pjesi.example.com
  5. Essayist detects that a request is made to a subdomain, looks up who owns it and loads that profile's essays and displays them.

Each essay displayed at pjesi.example.com has a permalink containing the post ID. The user can optionally specify a permalink for each essay so that pjesi.example.com/essay/my-essay could point to a specific post.

With this in place, Essayist can serve a as a blogging application. That is the rough idea.

mwanji commented 11 years ago

Interesting.

Shouldn't we have the ability to map a custom essay ID to the underlying Tent post ID first? So we're sure that ability is decoupled from the custom domain thing.

pjesi commented 11 years ago

I was thinking that the permalink would be optional. So you would map it after the post had been created so you have the post ID. But yes it would be decoupled from the custom domain thing. Basically these are two stories that can be independent.

For example, given the following essay: http://essayist.mndj.me/hisaac.tent.is/essay/0H8n1iBm_mzZE6lAJIW48g

hisaac could map 0H8n1iBm_mzZE6lAJIW48g to "a-boring-test", resulting in his essay being available at http://essayist.mndj.me/hisaac.tent.is/essay/a-boring-test

hisaac could also map his entity to hisaac.essayist.mndj.me, resulting in his essay being available at http://hisaac.essayist.mndj.me/essay/0H8n1iBm_mzZE6lAJIW48g

Now, if he both configures a domain and a permalink, then the essay is available at http://hisaac.essayist.mndj.me/essay/a-boring-test

mwanji commented 11 years ago

Agreed.

mwanji commented 11 years ago

Looking at the diff:

Thanks for the contribution!

pjesi commented 11 years ago

I will do #1 now. For #2, I agree but I don't quite understand how Jamon works. Could you explain how I could do that?

mwanji commented 11 years ago

For #2, I agree but I don't quite understand how Jamon works. Could you explain how I could do that?

For example, if you look at EssayPage.jamon:

<&| Layout; active = active; title = Entities.essayTitle(content) &>
 ...body...
</&>

That means the Layout.jamon template is wrapped around the body content and the active and title arguments are passed to the template. In Layout.jamon:

<%args>
boolean showNav = true;
String active = null;
String title = "Essayist";
</%args>

That defines the arguments that can be passed to the Layout template, either from another template (as EssayPage does) or via direct instantiation (e.g. EssayServlet#doGet). The values assigned are defaults that can be overridden. If no value is assigned, the argument is mandatory.

Unfortunately, it seems you can only use hardcoded or static values as defaults. I guess to work around this, you could set the default to null. If it's null, get an app name from the properties. If that's absent, use "Essayist". You can put this logic in, say, JamonContext#getAppName() and call it from Layout.

JamonContext is globally available in all templates via the implicit variable jamonContext. It's a class defined in jamon.properties.

I hope that helps.

pjesi commented 11 years ago

Thanks. I was actually doing something similar on my custom-domain branch and there I discovered that I could probably do it through jamonContext. I will try it out.

mwanji commented 11 years ago

@pjesi you might want to rebase.

pjesi commented 11 years ago

I tried to make the title dynamic but I didn't manage it :l

mwanji commented 11 years ago

No worries, I'll do it. Just make sure your branch is up-to-date and I'll merge it in locally and add the feature.

pjesi commented 11 years ago

thanks

On Tue, Jan 22, 2013 at 9:39 AM, Moandji Ezana notifications@github.comwrote:

No worries, I'll do it. Just make sure your branch is up-to-date and I'll merge it in locally and add the feature.

— Reply to this email directly or view it on GitHubhttps://github.com/mwanji/essayist/pull/65#issuecomment-12536754.

mwanji commented 11 years ago

Merged in 03d4bd7d12b30c8c5f4b85a0c570545b313352be and d7882608f0dafd7202b2761521c9c2e2f7f27851

I apparently messed up the first commit when I merged your changes, which makes it look like I'm the author. I apologise for that!