Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Tipue Search to v5.0 #99

Closed
wants to merge 1 commit into from
Closed

Upgrade Tipue Search to v5.0 #99

wants to merge 1 commit into from

Conversation

humitos
Copy link
Member

@humitos humitos commented Aug 4, 2015

  • New JS and CSS files for Tipue Search v5.0.
  • LateTask to create "search.html" page to use for search entries

 - New JS and CSS files for Tipue Search v5.0.
 - LateTask to create "search.html" page to use for search entries
@humitos
Copy link
Member Author

humitos commented Aug 4, 2015

This is a first approach. I'm having some issues that I don't know how to fix them:

  1. I need to include some JS files in "body_end" from the template rendering. To do this, I added a new block in my custom base.tmpl:
[...]
    ${template_hooks['body_end']()}
    <%block name="extra_body_end">
    ### Leave this block alone.
    </%block>
</body>
[...]
  1. I'm not being able to render the search.tmpl that inherits from base.tmpl in the same way that it was rendered before. I'm not sure about the context I need to pass to it. I was trying this, but it didn't work:
context = copy(self.site.GLOBAL_CONTEXT)
            context.update({
                'lang': LocaleBorg().current_lang,
                'title': 'Search',
                'permalink': '/search.html',
            })

Doing this in this way, doesn't need nothing from the final user after installing the plugin and also it will look much better than a simple input in the navbar that breaks all the style of the page (even when it shows the results).

Does it make sense for you guys?

@ralsina
Copy link
Member

ralsina commented Aug 4, 2015

How does this break layout? http://ralsina.me/tr/es/weblog/index.html (search for london)

@ralsina
Copy link
Member

ralsina commented Aug 4, 2015

A more serious bug in the old version is that it only works with one language. In my site there's only data for the english versions of posts.

@ralsina
Copy link
Member

ralsina commented Aug 4, 2015

Last comment for a while: "didn't work" how?

@humitos
Copy link
Member Author

humitos commented Aug 4, 2015

Regarding the layout: I'm trying to render all the results in the same way that the posts are rendered in the index, for example. I mean, inside the "content" part of the webpage. This way will keep the style of the whole page (navbar on the top, results in the content part, footer after the results). Does it make sense for you?

Regarding the languages: (looking at the code) I think it is handling that case now, isn't?

Regarding the "didn't work" comment: the data is rendered but it seems the context I'm using is not the same as the used for other base.tmpl rendering because many stuff are not included when I render search.tmpl in this way. For example, all the bootstrap magic is not executed for some reason.

@ralsina
Copy link
Member

ralsina commented Aug 5, 2015

@humitos I don't understand what you mean by "bootstrap magic" ... I'll take a look at it now.

@ralsina
Copy link
Member

ralsina commented Aug 5, 2015

I built the demo site with this plugin enabled. The search page looks ok, except for the search form itself that looks bad, but that seems to be because the markup is wrong?

Also, it doesn't search?
nikola

See attached screnshot showing that boootstrap is loaded...

@Kwpolska
Copy link
Member

Kwpolska commented Aug 5, 2015

I have localsearch set up on https://irclogs.getnikola.com/ (src) that works this way and that looks good. Here’s how I did it:

  • I used stories/search.html, which is an empty page that is rendered using search.tmpl. You could probably make your task use the generic page renderer, and it does not need to be a LateTask.
  • I changed the CSS so it looks better with bootstrap.
  • I include tipuesearch.css everywhere, but I’m pretty sure it’s not necessary because I deleted the input styling. Could go in extra_head in search.tmpl.

PS. extra_js did not exist in the base theme, added in getnikola/nikola@5d22c2b.

conf.py

SEARCH_FORM = """
<form class="navbar-form navbar-left" action="/search/" role="search">
    <div class="form-group">
        <input type="text" class="form-control" id="tipue_search_input" name="q" placeholder="Search" autocomplete="off">
    </div>
    <button type="submit" class="btn btn-default">Submit</button>
</form>
"""

EXTRA_HEAD_DATA = """
<link rel="stylesheet" type="text/css" href="/assets/css/tipuesearch.css">
"""

search.tmpl

## -*- coding: utf-8 -*-
<%inherit file="base.tmpl"/>
<%block name="content">
<h1>Search</h1>
<noscript>Search requires JavaScript, sorry for the inconvenience.</noscript>
<div id="tipue_search_content">Use the search box in the navigation bar to search.</div>
</%block>

<%block name="extra_js">
${parent.extra_js()}
<script src="/assets/js/tipuesearch_set.js"></script>
<script src="/assets/js/tipuesearch.js"></script>
<script>
$(document).ready(function() {
    $('#tipue_search_input').tipuesearch({
        'mode': 'json',
        'contentLocation': '/assets/js/tipuesearch_content.json',
        'showUrl': false
    });
});
</script>
</%block>

css diff

--- /home/kwpolska/git/nikola-plugins/v7/localsearch/localsearch/files/assets/css/tipuesearch.css   2015-01-29 13:45:57.082000000 +0100
+++ plugins/localsearch/localsearch/files/assets/css/tipuesearch.css    2015-07-20 16:45:07.335161074 +0200
@@ -7,6 +7,7 @@
 */


+/* bootstrap has better styles
 #tipue_search_input
 {
      font: 12px/1.7 'open sans', sans-serif;
@@ -24,7 +25,7 @@
 #tipue_search_input:focus
 {
      border: 1px solid #ccc;
-}
+} */
 #tipue_search_button
 {
      width: 70px;
@@ -54,12 +55,12 @@

 #tipue_search_warning_head
 {
-     font: 300 16px/1.6 'open sans', sans-serif;
+     /*font: 300 16px/1.6 'open sans', sans-serif;*/
    color: #333;
 }
 #tipue_search_warning
 {
-     font: 12px/1.6 'open sans', sans-serif;
+     /*font: 12px/1.6 'open sans', sans-serif;*/
    color: #333;
    margin: 7px 0;
 }
@@ -75,12 +76,14 @@
 }
 #tipue_search_results_count
 {
-     font: 13px/1.6 'open sans', sans-serif;
+     /*font: 13px/1.6 'open sans', sans-serif;*/
+    font-size: 13px;
    color: #333;
 }
 .tipue_search_content_title
 {
-     font: 300 23px/1.6 'open sans', sans-serif;
+     /*font: 300 23px/1.6 'open sans', sans-serif;*/
+    font-size: 23px;
    margin-top: 31px;
 }
 .tipue_search_content_title a
@@ -95,13 +98,15 @@
 }
 .tipue_search_content_text
 {
-     font: 12px/1.7 'open sans', sans-serif;
+     /*font: 12px/1.7 'open sans', sans-serif;*/
    color: #333;
    padding: 13px 0;
 }
 .tipue_search_content_loc
 {
-     font: 300 13px/1.7 'open sans', sans-serif;
+    font-weight: 300;
+    font-size: 13px;
+     /*font: 300 13px/1.7 'open sans', sans-serif;*/
      overflow: auto;
 }
 .tipue_search_content_loc a
@@ -122,7 +127,7 @@
 {
    padding: 0;
    margin: 0;
-     font: 12px/1 'open sans', sans-serif;
+     /*font: 12px/1 'open sans', sans-serif;*/
 }
 #tipue_search_foot_boxes li
 {

@Kwpolska
Copy link
Member

Kwpolska commented Sep 8, 2015

What’s the status of this?

@ralsina
Copy link
Member

ralsina commented Sep 8, 2015

@humitos do you mind if I steal this one?

@humitos
Copy link
Member Author

humitos commented Sep 8, 2015

El 8 de septiembre de 2015 12:36:13 GMT-04:00, Roberto Alsina notifications@github.com escribió:

@humitos do you mind if I steal this one?


Reply to this email directly or view it on GitHub:
#99 (comment)

Not at all. Sorry, Im not having time right now. I will check again un a couple of days to see if its not solved. Thanks

Manuel Kaufmann
http://elblogdehumitos.com.ar/

@ralsina
Copy link
Member

ralsina commented Sep 8, 2015

Superseded by #111

@ralsina ralsina closed this Sep 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants